hi all
i have a qestion in previus question exam
and i cannot soluation it
can any one help me on it
http://www.phroon.com/up/file1/1111122.JPG
the question in the picture
plz dont late
thanks allllll
hi all
i have a qestion in previus question exam
and i cannot soluation it
can any one help me on it
http://www.phroon.com/up/file1/1111122.JPG
the question in the picture
plz dont late
thanks allllll
Last edited by Salem; 08-19-2007 at 04:06 AM. Reason: Remove centre tags
No, more like you have a question due for homework. Why is your post centered?
Hint: research fprintf and fgets and sscanf, also look around the FAQ.
The logic from there is simple,
read each line in a loop, scan it, equate the tax from the salary, write the new record into another file.
ohh ..
i dont know c programming
plz help me
plzz
Time for you to learn then. Check out the homework policy.i dont know c programming
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Looks like someone slacked off in class or didn't go to the lectures, there's no way you'd be asked to do something you hadn't been taught.
In classrooms that's usually true.
For a lot of jobs in the real world, some problem solving skills and adaptability are expected. In other words, being able to find a solution to a problem without someone to teach you how to do it. Those who can't solve problems in a classroom will fail dismally in such real world situations.
ok
thanks
but iam not have the answer yet !!
ok
byy
You do have the answer, no-one is going to do the work for you.
since im newb in c i gues i can try help him (since i will learn something too ).
at first we need to work with files so :
tutorial about files
then we shlould read what we was told by the elders ..
sscanf
fprintf
i guess you know how to do the rest .
P.s.
read about structs
why Gaos didn't had a wife ?
http://bsh83.blogspot.com
Lol, it's kind of obvious it's homework, but I must point out some lecturers(ignoramuses) will set assignments and hint on how to start the assignment while making reference to implementing C features that have not been taught yet...nice one...
That way when you start using stuff you haven't been taught and something goes wrong, then you have to start rewriting your code again with stuff you know and there goes wasted hours when you could have spent it on some other subject or eating a peanut butter and jelly sandwich.
hi
i have the answer
but i will ask if it write or wrong
answer:
Code:#include<stdio.h> #include<conio.h> FILE *infile,*outfile; struct my_rec{char name[10]; int id; int salary;}; typedef struct my_rec test; void main() { int i,j; double avg,sum=0; test sample[10]; //clrscr(); infile=fopen("c:\\aa.dat","r"); outfile=fopen("c:\\out.dat","w"); i=0; while (!feof(infile)) { fscanf(infile,"%s",&sample[i].name); fscanf(infile,"%d",&sample[i].id); fscanf(infile,"%d",&sample[i].salary); i++; } for(j=0;j<i;j++) {fprintf(outfile,"%d name= %s id = %d salary = %d tax = %d\n",j+1, sample[j].name, sample[j].id, sample[j].salary, (sample[j].salary*17)/100);} }
write or wrong ??????!!!!!!!!!!!!!!!
Depends on how you define right or wrong, read at least the following:
http://faq.cprogramming.com/cgi-bin/...&id=1043284376 (void main)
http://faq.cprogramming.com/cgi-bin/...&id=1043284351 (feof in loops)
You should be checking if you actually open the file, (fopen returns NULL if it fails), and you should be closing it at the end.
Oh and don't use conio.h.
Consider my suggestion, I didn't say it for fun - http://cboard.cprogramming.com/showp...05&postcount=2
Infact you seem to have ignored 99% of the posts in this thread.
I'm going to say wrong, but close - well not really close, but the idea is there.
okay ..
thanks