Notes for Final Lab - Copy.docx

# 0 float wind10 input data for int year0year numyears

• Notes
• 42
• 100% (1) 1 out of 1 people found this document helpful

This preview shows pages 10–15. Sign up to view the full content.

float Rain=1.0; float Wind=1.0; // Input Data for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("Enter rain for %d, %d:\n", year+1, month+1); scanf("%f",&Rain); Raindata[year][month]=Rain; } } for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("Enter WindSpeed for %d, %d:(mph)\n", year+1, month+1); scanf("%f",&Wind); WindSpeed[year][month]=Wind; } } } // Function to printdata void printdata(){ // Print data printf ("year\t month\t rain\t wind\n "); for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("%s\t %s\t %5.2f\t %5.2f\n", years[year],months[month],Raindata[year][month],WindSpeed[year][month]); } } printf ("sum the rainfall for each year\n"); printf ("year\t rain(sum)\n"); float sumRain = 0.0; for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { sumRain += Raindata[year][month]; }

This preview has intentionally blurred sections. Sign up to view the full version.

printf("%s\t %5.2f\n", years[year],sumRain); } } If I run the given program, following ouput will be generated: Do you want to input Precipatation data? (y for yes) Enter rain for 1, 1: Enter rain for 1, 2: Enter rain for 1, 3: Enter rain for 1, 4: Enter rain for 1, 5: Enter rain for 1, 6: Enter rain for 1, 7: Enter rain for 1, 8: Enter rain for 1, 9: Enter rain for 1, 10: Enter rain for 1, 11: Enter rain for 1, 12: Enter rain for 2, 1: Enter rain for 2, 2: Enter rain for 2, 3: Enter rain for 2, 4: Enter rain for 2, 5: Enter rain for 2, 6: Enter rain for 2, 7: Enter rain for 2, 8: Enter rain for 2, 9: Enter rain for 2, 10:
Enter rain for 2, 11: Enter rain for 2, 12: Enter rain for 3, 1: Enter rain for 3, 2: Enter rain for 3, 3: Enter rain for 3, 4: Enter rain for 3, 5: Enter rain for 3, 6: Enter rain for 3, 7: Enter rain for 3, 8: Enter rain for 3, 9: Enter rain for 3, 10: Enter rain for 3, 11: Enter rain for 3, 12: Enter rain for 4, 1: Enter rain for 4, 2: Enter rain for 4, 3: Enter rain for 4, 4: Enter rain for 4, 5: Enter rain for 4, 6: Enter rain for 4, 7: Enter rain for 4, 8: Enter rain for 4, 9: Enter rain for 4, 10: Enter rain for 4, 11: Enter rain for 4, 12: Enter rain for 5, 1: Enter rain for 5, 2: Enter rain for 5, 3: Enter rain for 5, 4:

This preview has intentionally blurred sections. Sign up to view the full version.

Enter rain for 5, 5: Enter rain for 5, 6: Enter rain for 5, 7: Enter rain for 5, 8: Enter rain for 5, 9: Enter rain for 5, 10: Enter rain for 5, 11: Enter rain for 5, 12: Enter WindSpeed for 1, 1:(mph) Enter WindSpeed for 1, 2:(mph) Enter WindSpeed for 1, 3:(mph) Enter WindSpeed for 1, 4:(mph) Enter WindSpeed for 1, 5:(mph) Enter WindSpeed for 1, 6:(mph) Enter WindSpeed for 1, 7:(mph) Enter WindSpeed for 1, 8:(mph) Enter WindSpeed for 1, 9:(mph) Enter WindSpeed for 1, 10:(mph) Enter WindSpeed for 1, 11:(mph) Enter WindSpeed for 1, 12:(mph) Enter WindSpeed for 2, 1:(mph) Enter WindSpeed for 2, 2:(mph) Enter WindSpeed for 2, 3:(mph) Enter WindSpeed for 2, 4:(mph) Enter WindSpeed for 2, 5:(mph) Enter WindSpeed for 2, 6:(mph) Enter WindSpeed for 2, 7:(mph) Enter WindSpeed for 2, 8:(mph) Enter WindSpeed for 2, 9:(mph) Enter WindSpeed for 2, 10:(mph)
Enter WindSpeed for 2, 11:(mph) Enter WindSpeed for 2, 12:(mph) Enter WindSpeed for 3, 1:(mph) Enter WindSpeed for 3, 2:(mph) Enter WindSpeed for 3, 3:(mph)

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Fall '09
• Rain, scanf, enter, windspeed

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern