Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help Please CSC 118: Programming Fundamentals Lab 7: Programming assignment Programming assignment 1 (Multiway Branching): Exercise 1: As Quiz Exercise 2 demonstrated, program Switches is

Help Please
image text in transcribed
CSC 118: Programming Fundamentals Lab 7: Programming assignment Programming assignment 1 (Multiway Branching): Exercise 1: As Quiz Exercise 2 demonstrated, program Switches is not very robust. Add the code necessary to allow the program to work properly with both lowercase and uppercase versions of the input letters. Run your program with the same data, but type in the letters as lowercase. Exercise 2: Program Switches is still not very robust. Add a default case that prints an error message and asks for the letter to be reentered. Test your program with the same data set, but add several letters that are not correct Exercise 3: Program CounMarks is the shell of a program that counts all the punctuation marks in a file. // Program CountMarks counts punctuation marks in a file. #include #include using namespace std; int main () ifstream inData; char symbol; int periodct e; int commaCt e; int questionct ; int colonct=0; int semicolonCt ; inData.open("switch.dat"); FILL IN / return 0; Fill in the missing code and run your program. Show the counts in the following table. Periods:- Commas: Semicolons: Question marks: Colons: Exercise 4: Add the code necessary for program CountMarks to count blanks as well. How many blanks are there in file switch.dat? If you did not get a count of 12, go back and check your program. Turn in: Your code for Exercises 1 and 2 and your code for Exercises 3 and 4. CSC 118: Programming Fundamentals Lab 7: Programming assignment Programming assignment 1 (Multiway Branching): Exercise 1: As Quiz Exercise 2 demonstrated, program Switches is not very robust. Add the code necessary to allow the program to work properly with both lowercase and uppercase versions of the input letters. Run your program with the same data, but type in the letters as lowercase. Exercise 2: Program Switches is still not very robust. Add a default case that prints an error message and asks for the letter to be reentered. Test your program with the same data set, but add several letters that are not correct Exercise 3: Program CounMarks is the shell of a program that counts all the punctuation marks in a file. // Program CountMarks counts punctuation marks in a file. #include #include using namespace std; int main () ifstream inData; char symbol; int periodct e; int commaCt e; int questionct ; int colonct=0; int semicolonCt ; inData.open("switch.dat"); FILL IN / return 0; Fill in the missing code and run your program. Show the counts in the following table. Periods:- Commas: Semicolons: Question marks: Colons: Exercise 4: Add the code necessary for program CountMarks to count blanks as well. How many blanks are there in file switch.dat? If you did not get a count of 12, go back and check your program. Turn in: Your code for Exercises 1 and 2 and your code for Exercises 3 and 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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions