Question
// C Programming You are to add the missing functions in provide.c. When completed the program must support the following features. When the program starts
// C Programming
You are to add the missing functions in provide.c. When completed the program must support the following features. When the program starts ask for the user's name (3 words) it must then ask how many integers and doubles the program should support (it must be able to handle up to that many values) it will then present a menu to the user the menu options are: 1 - Author info 2 = Enter integer 3 - Enter double 4 - Clear values 5 - Print values 6 - Sum integers 7 - Sum doubles 0 - Exit Option 0 must exit the program Option 1 must print information about the program, this must include the currently logged in user, the name and id of the author, as well as your author code which is: 377 it must also print how many characters were printed to the screen for the listed data Option 2 must take in 1 integer and store it into the program's memory Option 3 must take in 1 double and store it into the program's memory Option 4 must clear entered values. Option 5 must print all entered integers and doubles. Option 6 must print the sum of all entered integers Option 7 must print the sum of all entered doubles.
----------------------------------------------------------------------------------------------------------------------
#include
#include
#include
//do not edit anyting below this line (your changes will not be included when grading)
int main()
{
int maxint, maxdouble;
char name[512];
int sel;
int *ints;
int icount = 0, dcount = 0;
double *doubles;
setUsername(name);
ints = initializeInts(&maxint);
doubles = initializeDoubles(&maxdouble);
int len;
while(1)
{
printf(" Welcome %s 0) Exit 1) Author Info 2) Enter int 3) Enter doubles 4) Clear values 5) Print values 6) Sum Integers 7) Sum doubles ", name);
scanf("%d", &sel);
if (sel == 0)
{
break;
}
else if (sel == 1)
{
len = printProgramInfo(name);
printf("Info data: %d ", len);
}
else if (sel == 2)
{
if (icount == maxint)
{
printf("Already at max values, clear values to continue ");
continue;
}
enterInt(ints, &icount);
}
else if (sel == 3)
{
if (dcount == maxdouble)
{
printf("Already at max values, clear values to continue ");
continue;
}
dcount = enterDouble(doubles,dcount);
}
else if (sel == 4)
{
icount = dcount = 0;
}
else if (sel == 5)
{
printVals(ints,icount,doubles,dcount);
}
else if (sel == 6)
{
printf("Sum of ints: %d ", sumInts(ints, icount));
}
else if (sel == 7)
{
printf("Sum of doubles: %lf ", sumDoubles(doubles, dcount));
}
else
{
printf("Invalid Selection ");
}
}
return(0);
}
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