#include <stdio.h>
#include <math.h>
#include <chplot.h>
#define N 10 /*for 5 step size*/
#define A 10.0 /*constant value of shear stress in kgf/mm^2*/
double calculate_thickness(double r);
int main(){
int x0=100,xf=500,xstep=50;
double i,j,r,w,E;
double P[N],t[N];
printf("Enter the value of plate width, w in mm: ");
scanf("%lf",&w);
printf("*Enter 1 for radiography inspection\n");
printf("*Enter 2 for no radiography inspection\n");
printf("Enter your type of inspection: ");
scanf("%lf",&r);
printf(" Tensile load,P(kN) | thickness,t(mm) \n");
printf("--------------------------------------------\n");
if(r == 1){
E=0.9;
for (i=0; i<n;> P[i]=x0+i*xstep;
t[i]=P[i]/(w*(E*A));
printf(" %6.f | %6.3f \n",P[i],t[i]);
}
}
else if(r ==2){
E=0.65;
for (j=0; j<n;> P[j]=x0+j*xstep;
t[j]=P[j]/(w*(E*A));
printf(" %6.f | %6.3f \n",P[j],t[j]);
}
}
else{
printf("Error!\n");
}
return 0;
}
double calculate_thickness(double r)
{
int i,j,r;
double t[N],P[N];
if (r == 1){
scanf("%lf",&P[i]);
scanf("%lf",&t[i]);
}
else if (r == 2){
scanf("%lf",&P[j]);
scanf("%lf",&t[j]);
}
else{
printf("Error!");
}
plotxy(P, t, N, "Acceleration Plot","Tensile load(kN)", "thickness(mm)");
return 0;
}
What I have tried:
I already try to used another function and check the note what I have learn in array rules. I have no idea why the graph is not come out. The error said that "ERROR: computational array type qualifier applied to a scalar variable
ERROR: function cannot return C array, it can only return computational array"