Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, please convert this C++ code into Shell Script (Unix/Linux) using namespace std; int main() { // random number generator srand(time()); // defining objects for

Hi, please convert this C++ code into Shell Script (Unix/Linux)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

using namespace std; int main() { // random number generator srand(time()); // defining objects for mathreport & mathoperations MathReport r; MathOperations q; // declaring / initializing variables int choice; int numberone = ; int numberTwo = 0; int studentAnswer; // while loop for displaying menu while(choice != 4){ // printing menu cout > choice; // ignoring for blank line if(cin.peek() == ' '){ cin.ignore(); // if not int or if less than one or greater than four, invalid 1/ recieved help for this statement if(cin.fail() || choice 4){ cout > studentAnswer; // ignoring cin.ignore(200, ' '); // while cin fails while(cin.fail(){ // clearing & ignoring cin.clear(); sin ignore(200, ' '); // invalid statement cout > studentAnswer; cin.ignore(200, ' '); // if statement for if the answer is right if(q.checkAnswer( studentAnswer)){ // congrats statement cout > studentAnswer; 17 ignoring cin. ignore(200,' '); 1/input validation loop while (cin.fail()) { // clearing cin.clear(); // ignoring cin. ignore (200, ' '); // invalid statement cout > studentAnswer; // ignoring again cin. ignore(200, ' '); // if answer is correct if (q.checkAnswer(studentAnswer)) // congrats statement cout > studentAnswer; // ingoring, again sin ignore(200,' '); //input validation loop while (cin.fail()){ // clearing cin.clear(); // ignoring cin.ignore (200, ' '); // invalid statement cout > studentAnswer; // ignoring again cin.ignore(200, ' '); // if the answer is correct if (q.checkAnswer student Answer)) 11 congrats statement cout > choice; // ignoring for blank line if(cin.peek() == ' '){ cin.ignore(); // if not int or if less than one or greater than four, invalid 1/ recieved help for this statement if(cin.fail() || choice 4){ cout > studentAnswer; // ignoring cin.ignore(200, ' '); // while cin fails while(cin.fail(){ // clearing & ignoring cin.clear(); sin ignore(200, ' '); // invalid statement cout > studentAnswer; cin.ignore(200, ' '); // if statement for if the answer is right if(q.checkAnswer( studentAnswer)){ // congrats statement cout > studentAnswer; 17 ignoring cin. ignore(200,' '); 1/input validation loop while (cin.fail()) { // clearing cin.clear(); // ignoring cin. ignore (200, ' '); // invalid statement cout > studentAnswer; // ignoring again cin. ignore(200, ' '); // if answer is correct if (q.checkAnswer(studentAnswer)) // congrats statement cout > studentAnswer; // ingoring, again sin ignore(200,' '); //input validation loop while (cin.fail()){ // clearing cin.clear(); // ignoring cin.ignore (200, ' '); // invalid statement cout > studentAnswer; // ignoring again cin.ignore(200, ' '); // if the answer is correct if (q.checkAnswer student Answer)) 11 congrats statement cout

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

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions