Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

t plz use this provided code for using Pointers and other modification :: #include void plotGraph(double d,char c) { int i,j; int a=(int)d;

timage text in transcribedimage text in transcribed

plz use this provided code for using " Pointers " and other modification ::

#include

void plotGraph(double d,char c)

{

int i,j;

int a=(int)d;

double d1=(d-a)*10;

int b=(int)d1;

//printf("%f %d %d",d,a,b);

//getchar();

for(i=1;i

{

for(j=1;j

{

printf("%c",c);

}

}

for(i=1;i

{

printf("%c",c);

}

}

int main()

{

int i;

char month[6][20]={"January |","February |","March |","April |","May |","June |"};

float normal[6],current[6],nor_sum,cur_sum;

int cur_max_index;

printf("Enter 6 months data normal-2018: ");

for(i=0;i

{

scanf("%f",&normal[i]);

scanf("%f",¤t[i]);

}

printf("Entered data: ");

for(i=0;i

{

printf("%.2f %.2f ",normal[i],current[i]);

}

for(i=0;i

{

//printf("i:%f ",normal[i]);

//getchar();

printf(" %s",month[i]);

plotGraph(normal[i],'*');

printf(" |");

plotGraph(current[i],'!');

}

printf(" |");

for(i=1;i

{

printf("----%d",i);

}

printf(" LEGEND(Numbers below are for illustration purpose only)");

nor_sum=normal[0];

cur_sum=current[0];

cur_max_index=0;

for(i=1;i

{

nor_sum+=normal[i];

cur_sum+=current[i];

if(current[cur_max_index]

cur_max_index=i;

}

printf(" Total rain fall was %.2f mm",nor_sum);

printf(" Total rain fall for 2018 was %.2f mm",cur_sum);

(nor_sum>cur_sum)?

printf(" 2018 was drier than normal by %.2f mm",nor_sum-cur_sum):printf(" Normal was drier than 2018 by %.2f mm",cur_sum-nor_sum);

printf(" The month %s and the rain fall amount, with highest rain fall in 2018 was, %.2f",month[cur_max_index],current[cur_max_index]);

}

IMP : Plz modify the code as require in the assignment. don't upload same code without updating or without using "Pointers"

thanks in advance ! Really your help would be appreciable !!!

Solve this problem using pointer variables for parameter passing, where appropriate and pointer arithmetic when working with arrays PROBLEM: Re-do the last rainfall C program you wrote to use pointers wherever possible. Fix any problems you had with the last program. Produce the EXACI output shown at the end of the document. 1. Generate a graph that compares, on a month-by-month basis, the monthly rainfall for Kamloops for the first half of 2018 (i.e. Jan June) versus the normal (30 year average) rainfall for Kamloops for the same months 2. In main(), create the 2 data arrays using initializations lists, and also create this array char *months[6] -["January", "February", "March", "April", "May", "June" \; Create and call ONE function to print one line of symbols . call it the first time to print the line of* e call it a second time to print the line of ! 3. no if statement is needed or allowed in this function . Think very carefully about the parameter list for this function 4. Call a function to print the scale and the legend as shown below 5. Call a function to find and print the total rainfall for each data set, and also the comparison of the two totals. The function will state whether 2018 was wetter, drier, or equal to a normal 6 month rainfall and by how much 6. Call a function to determine which month in 2018 had the highest rainfall, and print the month name (using the function described in #2), the rainfall amount and how that amount compares to the normal amount for that month Input will consist of 6 pairs of numbers representing the normal rainfall for the month and the 2018 rainfall amount for the same month. Use the exact data shown below when you run your program, Note: the data and output below are for illustration purposes only. Your program must be able to work with any data that has this format 3.1 5.4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions