Please help me .. I want solution by C programm
What did you come up with so far?
what do you mean ? i can't understand you
I mean that I am not going to do your work for you. Why would I or anyone do that? Not only does it keep you from learning when others do your work, it is also against the CoC: http://openstudy.com/code-of-conduct Give Help, Not Answers - I will encourage and guide those needing help, and not just give them an answer However, I can help when you are stuck. To do that, I would need to know what you have come up with so far or where you had a problem.
Ahaaa now i had understand you ! Thanks very much for your advice .. :) I do not want the all of solution " programm " ,, I want the idea which I can build my programm about . because I am beginner
Well, you know there is file I/O to get the data. That data is numeric and floating point, so you need to put it into that type of value.
I had try and try then try again but no positive result :/ can you help me ?! by the way , this question not assignment so you can help me :D
there is some thing wrong ... can you tell me about it ? #include<stdio.h> int main() { double current[12]; double last[12]; double currentTotal=0,lastTotal=0; double currentAvg=0,lastAvg=0; FILE *fp; int i=0; fp=fopen("rainfall.txt","r"); if(fp==NULL) { printf("File not found\n"); return 0; } while(!feof(fp)) { fscanf(fp,"%lf%lf",¤t[i],&last[i]); currentTotal+=current[i]; lastTotal+=last[i]; i++; } currentAvg=currentTotal/12; lastAvg=lastTotal/12; printf("**************************Table of Monthly Rainfall**************************\n"); printf("\t\tJanuary\tFebruary\tMarch\tApril\tMay\tJune\tJuly\tAugust\tSept\tOct\tNov\tDec\n"); printf("This Year\t"); for(i=0;i<12;i++) printf("%.2lf\t",current[i]); printf("\nLast Year\t"); for(i=0;i<12;i++) printf("%.2lf\t",last[i]); fclose(fp); printf("\nTotal rainfall this year: %.2lf",currentTotal); printf("Total rainfall last year: %.2lf",lastTotal); printf("Average monthly rainfall for this year: %.2lf",currentAvg); printf("Average monthly rainfall for last year: %.2lf",lastAvg); return 0; }
Well, I don't have the data file, and I am more a c++ person than c.
Join our real-time social learning platform and learn together with your friends!