Solved no error showing,cant put input values??

August 21, 2014 at 08:50:41
Specs: Windows 7
#include<stdio.h>
#include<math.h>
int main()
{
float cp,cv,R,k,c,p1,t1,n,p3,w,v1,p2,v2,t2,t3,v3,p4,v4,t4,qs,qr,mep;
printf("\ncompression ratio=");
scanf("%d",&c);
printf("\ncp=");
scanf("%d",&cp);
printf("\nenter cv=");
scanf("%d",&cv);
printf("\nenter R=");
scanf("%d",&R);
printf("\nenter k=");
scanf("%d",&k);
printf("\npressure at point 1=");
scanf("%d",&p1);
printf("\ntemp at point 1=");
scanf("%d",&t1);
printf("\npressure at point 3=");
scanf("%d",&p3);
printf("\nnet work output=");
scanf("%d",&w);
p2=p1*pow(c, k);
t2=t1*pow (c, (k-1));
n=1-(1/pow (c, (k-1)));
qs=w/n;
t3=t2+(qs/cv);
t4=t3/pow (c, (k-1));
qr=cv*(t4-t1);
v1=(R*t1)/p1;
v2=(R*t2)/p2;
v3=v2;
v4=v1;
mep=w/(v1-v2);
printf ("\npressure at point2=%d",p2);
printf ("\ntemp at point2=%d",t2);
printf ("\nefficiency=%d",n);
printf ("\nheat supplied=%d",qs);
printf ("\ntemp at point 3=%d",t3);
printf ("\ntemp at point 4=%d",t4);
printf ("\nheat rejected=%d",qr);
printf ("\nvolume at point 1=%d",v1);
printf ("\nvolume at point 2=%d",v2);
printf ("\nvolume at point 3=%d",v3);
printf ("\nvolume at point 4=%d",v4);
printf ("\nmean effective pressure=%d",mep);

}

See More: no error showing,cant put input values??

Report •


#1
August 21, 2014 at 09:44:22
✔ Best Answer
One of the problems is defining your variables as float and inputing/printing as decimals:

scanf("%d",&p1);
printf ("\npressure at point2=%d",p2);

Try changing %d to %f

message edited by nails


Report •
Related Solutions


Ask Question