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 conversation is currently closed to new comments.
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
C Source code help
.
..
...
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" )