C Source code help - TechRepublic
General discussion
January 28, 2010 at 11:37 PM
vicpri

C Source code help

by vicpri . Updated 16 years, 5 months ago

Hello, while doing the below c program, i am not getting the output….can u please help me to get the output by changing the source code, it’s urgent plsz help me……
.
..

http://pastebin.com/m5f39b3de
.
..

or
.
..

/*Functions using fprintf and fscanf*/
#include
#include
main()
{
FILE *fp;
int sno,b,aa,bs,t;
char sname[20],ch;
float avg;
clrscr();
fp=fopen(“Bcom.txt”,”a”);
if(!fp)
{
printf(“File Opening Error”);
exit();
}
else
{
printf(“File is Openend”);
printf(“\nEnter Student Details”);
do
{
printf(“\nEnter Student no\t”);
scanf(“%d”,&sno);
printf(“\nEnter Student Name\t”);
scanf(“%s”,&sname);
printf(“\nEnter 3 Subject Marks\t”);
scanf(“%d%d%d”,&b,&aa,&bs);
t=b+aa+bs;
avg=t/3;
fprintf(fp,”\n\t%d\n%s\n%d\n%d\n%d\n%d%d%f”);
printf(“Do u want to add any record (y/n)”);
fflush(stdin);
ch=getch();
}
while(ch==’y’)
rewind(fp);
}
while(!eof(fp))
{
printf(“%d%s%d%d%d%d%f”,sno,sname,b,aa,bs,t,avg);
}
fclose(fp);

(Error:

rewind(fp);

for the above line it is showing “do-while statement missing ; in function main” )

This discussion is locked

All Comments