Question
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;
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;
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 !!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started