Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this part of my assignment. All code is provided for context! You have been given 8 C files, each has the
I need help with this part of my assignment. All code is provided for context!
You have been given C files, each has the same logic, expressed in different ways. Each of the files is incomplete, marked by TBD You must replace each TBD entry with appropriate C code. You must NOT alter any of the existing lines. You are only allowed to replace each TBD line with new lines.
Each of the C programs do exactly the same task. Given a list of numbers on the command line, they find the sum, sum of squares and the sum of cubes. You do not have to add error checking. You can safely assume that all numbers are given nicely as integers on the command line and are in the range of to
The output from all programs will be the same for the same arguments.
Part I: Implementation.
Get each of the C files to compile and produce the results such as given above. Submit your code and output in Blackboard. Please submit a single zip file, called Lastnameabczip, with the following contents:
Your modified C files
Optional: your modified python file
Output from your C files and optional python file in a single file called sum.out.
Answers to the following Part II questions in a text file called sum.txt
Here is an implementation of sum in sumc
static int sumint argc, char argv
int sumsq ;
int i;
for i ; i argc; i
int n atoiargvi;
sumsq n n;
return sumsq;
Code given with assignment:
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
static int sumint argc, char argv
TBD
static int sumint argc, char argv
TBD
static int sumint argc, char argv
TBD
int mainint argc, char argv
TBD
printfSumd Sumd Sumd
x y z;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
static int x; Sum
static int y; Sum squares
static int z; Sum cubes
static void sumint argc, char argv
TBD
int mainint argc, char argv
TBD
printfSumd Sumd Sumd
x y z;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
typedef struct
int x; Sum
int y; Sum squares
int z; Sum cubes
sumt;
static sumt sumint argc, char argv
static sumt sum;
TBD
return
int mainint argc, char argv
sumt m;
TBD
printfSumd Sumd Sumd
mx my mz;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
typedef struct
int x; Sum
int y; Sum squares
int z; Sum cubes
sumt;
static void sumint argc, char argv sumt sum
TBD
int mainint argc, char argv
sumt m;
TBD
printfSumd Sumd Sumd
mx my mz;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
typedef struct
int x; Sum
int y; Sum squares
int z; Sum cubes
sumt;
static sumt sumint argc, char argv
sumt sum sumt mallocsizeofsumt;
TBD
return sum;
int mainint argc, char argv
TBD
printfSumd Sumd Sumd
mx my mz;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
static void sumint argc, char argv int x int y int z
TBD
int mainint argc, char argv
int x y z;
TBD
printfSumd Sumd Sumd
x y z;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
#define sumargc argv, x y z
x ;
y ;
z ;
int i;
TBD
int mainint argc, char argv
int x y z;
TBD
printfSumd Sumd Sumd
x y z;
return ;
gcc Wall sumc o sum
sum
prints: Sum Sum Sum
#include
#include
sums is sum, is sum squares, is sum cubes
static void sumint argc, char argv int sums
TBD
int mainint argc, char argv
int sums; sums is sum, is sum squares, is sum cubes
TBD
printfSumd Sumd Sumd
sums sums sums;
return ;
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