Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The purpose of this code is to have you writing basic C programs and to get used to using Makefiles. Deliverables: One sample C program
The purpose of this code is to have you writing basic C programs and to get used to using Makefiles.
Deliverables:
One sample C program for each of the following control structures:
if else statement
while loop
for loop
dowhile loop
switch statement
For each program other than the switch statement read in a number from the user using scanf and then do something with the control statement. ie read in a number, and then do the ifelse with the number, printing something different based on the input It isn't important what you do but more important that you show you know how the control structure works by using the input from the user.
For the switch statement, read in a char use getchar and then have a switch statement that prints out something based on the input. Having at least one "fallthough" case without a break. I suggest a caseinseneitive menu where you can enter an A or an a and have it run the same code, B or b to run some different code, etc. Make sure that it has a "default" at the end.
One Makefile with the following targets:
one target for each program ie an if target, a "while" target that generates a program of that name
one "all" target which generates all of the executables
one "clean" target which deletes all of the executables
Note: You don't need to generate a o file with this Makefile, but if you do make sure you delete the o files when you run the "clean" target.
This assignment is not intended to be difficult, but just to have you write snippets of code to make sure that you understand how the code works.
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