Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Visit http://www.cplusplus.com/reference/clibrary/. Under Reference tab on th

ID: 3853721 • Letter: A

Question

a. Visit http://www.cplusplus.com/reference/clibrary/. Under Reference tab on the left side, There are 5 libraries on the list: C library, Containers, Input/output, Multi-threading and Other. Spend a few minutes browsing through the header files. To answer this question, look for three of the header files: iomanip, cmath and string. Then provide a brief description of each of them. b. Click on the iomanip header file. c. What is ? d. What is the ?

Question 3: Convert the following if .. else if statement to switch statement: if ( x == 1 )

cout << “This is the test 1” << endl; else if ( x == 2 || x==3)

cout << “This is the test 2 ot test 3” << endl; else if ( x == 4)

cout << “This is the test 3 or test 4” << endl; else cout << “This is the other test” << endl;

Line Number at Declaration Line Number When Initialized Variable Name Data Type Value in Memory Result Result Pressing Shift- F5 to stop debugging c. Test the program with the following input values of x without debug (press Fn-F5) Sqrt(x) Input Values (x) 49 289 729 1369 2209 3249 pow(x, 0.5)

Explanation / Answer

" iomanip"

This header is used when we need to manipulate the inpu /out for formating. The formating need to be control by the input parameter like in how many field the output should be printed then we need setw(inputparameter) to fixed the field. Here the "inputparameter" will fixed the filed of out put.

"cmath "

This is neede whene be used some maths function in our program like for finding the squareroot of some number. Or claulcting some trigonometric function like sin , cos etc

" string"

This header file defines several functions to manipulate C strings and arrays.

strcpy : to copy one tring to other

strcat: for Concatenation of two string strings

etc.

Question 3: Convert the following if .. else if statement to switch statement: if ( x == 1 )

cout << “This is the test 1” << endl; else if ( x == 2 || x==3)

cout << “This is the test 2 ot test 3” << endl; else if ( x == 4)

cout << “This is the test 3 or test 4” << endl; else cout << “This is the other test” << endl;

Ans: switch (x){
case 1 :
cout << "This is the test 1" << endl;
break;
case 2 :
case 3 :
cout << "This is the test 2 ot test 3" << endl;
break;
case 4 :
cout << "This is the test 3 or test 4" << endl;
break;

default :
cout << "This is the other test"<< endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote