x.Hmone figure out why the variables percent and ttlpercent will not calculate?
ID: 3617773 • Letter: X
Question
x.Hmone figure out why the variables percent and ttlpercent will not calculate?// ***************************** //Program Title: Project_09 //Project File: Project_09.cpp //Name: Bryan Britt //Course Section: CPE-112-02 //Lab Section: 4 //Due Date: 4/2/10 //Description: Create a program that uses a random number generator to produce //addition and subtraction flash cards and keeps a running total of number of //correct and incorrect. //****************************** #include <iostream> #include <iomanip> #include <string> #include <cstdlib> #include <cmath> using namespace std; //Global Constants const int MIN_NUM = 0; //global constant for min number in problem const int MAX_NUM = 20; //global constant for max number in problem //Function Prototypes void srand(int); //Integer for seedValue for random number generator void PrintMenu(); //Parameterless function to cout print the main menu int MenuSelection(int); //Function to test that the menu selection is in a valid range int NumProblems(int); //Function to test that the number of problems selected is in a valid range int CurrentProblem(int); //Function to print the current problem number int Addition(int, int, int); //Function that generates an addition flash card int Subtraction(int, int, int); //Function that generates a subtraction flash card //Main Function Body int main () { int ttlcorrect = 0, ttlincorrect = 0; //Global counters for number correct and incorrect problems answered, these do not reset with loops int seedValue; //Variable(s) for the function srand int input; //Variable(s) for the function MenuSelection int numproblems; //Variable(s) for the function NumProblems int currentproblem; //Variable(s) for the function CurrentProblem int num1, num2, correct, incorrect, correctanswer, youranswer; //Variable(s) for the functions Addition and Subtraction int totalworked = 0; //Total number of problems worked, correct or incorrect float percent, ttlpercent = 0; //Variables for percent correct for current loop, and for global //Seed Value Defined only once cout << "Enter seed value:" << endl; //Prompt for seed value (only once) srand(seedValue); //Function takes in the integer entered, echo prints PrintMenu(); //Print menu using function for priming read cin >> input; input = MenuSelection(input); //Test a user input integer for range, reprompt if invalid while(input != 5) { //Addition************************************************************ if (input == 1) { //Only happens once currentproblem = 1; //reguardless of input, currentproblem counter is reset to 1 correct = 0; //the number you have correct for the current set of problems needs to reset to 0 incorrect = 0; //the number you have incorrect for the current set of problems needs to reset to 0 cout << "Please input the number of problems you wish to work between 1 and 10 (inclusive): "; //priming read for NumProblems cin >> numproblems; numproblems = NumProblems(numproblems); //Verifies that a valid number is input, also accounts for 0 if (numproblems == 0) { cout << "You have chosen not to work any problems." << endl; PrintMenu(); cin >> input; input = MenuSelection(input); } else { while (currentproblem <= numproblems) //Do flashcards until the current problem = the number of problems you asked to work { currentproblem = CurrentProblem(currentproblem); //Outputs the problem that you are on, and increments the counter +1 correctanswer = Addition(num1, num2, correctanswer); //Generate and display a random addition problem cin >> youranswer; cout << endl; if (correctanswer == youranswer) { cout << "Correct" << endl; correct++; ttlcorrect++; totalworked++; } else { cout << "Incorrect" << endl; incorrect++; ttlincorrect++; &nbs
// ***************************** //Program Title: Project_09 //Project File: Project_09.cpp //Name: Bryan Britt //Course Section: CPE-112-02 //Lab Section: 4 //Due Date: 4/2/10 //Description: Create a program that uses a random number generator to produce //addition and subtraction flash cards and keeps a running total of number of //correct and incorrect. //****************************** #include <iostream> #include <iomanip> #include <string> #include <cstdlib> #include <cmath> using namespace std; //Global Constants const int MIN_NUM = 0; //global constant for min number in problem const int MAX_NUM = 20; //global constant for max number in problem //Function Prototypes void srand(int); //Integer for seedValue for random number generator void PrintMenu(); //Parameterless function to cout print the main menu int MenuSelection(int); //Function to test that the menu selection is in a valid range int NumProblems(int); //Function to test that the number of problems selected is in a valid range int CurrentProblem(int); //Function to print the current problem number int Addition(int, int, int); //Function that generates an addition flash card int Subtraction(int, int, int); //Function that generates a subtraction flash card //Main Function Body int main () { int ttlcorrect = 0, ttlincorrect = 0; //Global counters for number correct and incorrect problems answered, these do not reset with loops int seedValue; //Variable(s) for the function srand int input; //Variable(s) for the function MenuSelection int numproblems; //Variable(s) for the function NumProblems int currentproblem; //Variable(s) for the function CurrentProblem int num1, num2, correct, incorrect, correctanswer, youranswer; //Variable(s) for the functions Addition and Subtraction int totalworked = 0; //Total number of problems worked, correct or incorrect float percent, ttlpercent = 0; //Variables for percent correct for current loop, and for global //Seed Value Defined only once cout << "Enter seed value:" << endl; //Prompt for seed value (only once) srand(seedValue); //Function takes in the integer entered, echo prints PrintMenu(); //Print menu using function for priming read cin >> input; input = MenuSelection(input); //Test a user input integer for range, reprompt if invalid while(input != 5) { //Addition************************************************************ if (input == 1) { //Only happens once currentproblem = 1; //reguardless of input, currentproblem counter is reset to 1 correct = 0; //the number you have correct for the current set of problems needs to reset to 0 incorrect = 0; //the number you have incorrect for the current set of problems needs to reset to 0 cout << "Please input the number of problems you wish to work between 1 and 10 (inclusive): "; //priming read for NumProblems cin >> numproblems; numproblems = NumProblems(numproblems); //Verifies that a valid number is input, also accounts for 0 if (numproblems == 0) { cout << "You have chosen not to work any problems." << endl; PrintMenu(); cin >> input; input = MenuSelection(input); } else { while (currentproblem <= numproblems) //Do flashcards until the current problem = the number of problems you asked to work { currentproblem = CurrentProblem(currentproblem); //Outputs the problem that you are on, and increments the counter +1 correctanswer = Addition(num1, num2, correctanswer); //Generate and display a random addition problem cin >> youranswer; cout << endl; if (correctanswer == youranswer) { cout << "Correct" << endl; correct++; ttlcorrect++; totalworked++; } else { cout << "Incorrect" << endl; incorrect++; ttlincorrect++; &nbs // ***************************** //Program Title: Project_09 //Project File: Project_09.cpp //Name: Bryan Britt //Course Section: CPE-112-02 //Lab Section: 4 //Due Date: 4/2/10 //Description: Create a program that uses a random number generator to produce //addition and subtraction flash cards and keeps a running total of number of //correct and incorrect. //****************************** #include <iostream> #include <iomanip> #include <string> #include <cstdlib> #include <cmath> using namespace std; //Global Constants const int MIN_NUM = 0; //global constant for min number in problem const int MAX_NUM = 20; //global constant for max number in problem //Function Prototypes void srand(int); //Integer for seedValue for random number generator void PrintMenu(); //Parameterless function to cout print the main menu int MenuSelection(int); //Function to test that the menu selection is in a valid range int NumProblems(int); //Function to test that the number of problems selected is in a valid range int CurrentProblem(int); //Function to print the current problem number int Addition(int, int, int); //Function that generates an addition flash card int Subtraction(int, int, int); //Function that generates a subtraction flash card //Main Function Body int main () { int ttlcorrect = 0, ttlincorrect = 0; //Global counters for number correct and incorrect problems answered, these do not reset with loops int seedValue; //Variable(s) for the function srand int input; //Variable(s) for the function MenuSelection int numproblems; //Variable(s) for the function NumProblems int currentproblem; //Variable(s) for the function CurrentProblem int num1, num2, correct, incorrect, correctanswer, youranswer; //Variable(s) for the functions Addition and Subtraction int totalworked = 0; //Total number of problems worked, correct or incorrect float percent, ttlpercent = 0; //Variables for percent correct for current loop, and for global //Seed Value Defined only once cout << "Enter seed value:" << endl; //Prompt for seed value (only once) srand(seedValue); //Function takes in the integer entered, echo prints PrintMenu(); //Print menu using function for priming read cin >> input; input = MenuSelection(input); //Test a user input integer for range, reprompt if invalid while(input != 5) { //Addition************************************************************ if (input == 1) { //Only happens once currentproblem = 1; //reguardless of input, currentproblem counter is reset to 1 correct = 0; //the number you have correct for the current set of problems needs to reset to 0 incorrect = 0; //the number you have incorrect for the current set of problems needs to reset to 0 cout << "Please input the number of problems you wish to work between 1 and 10 (inclusive): "; //priming read for NumProblems cin >> numproblems; numproblems = NumProblems(numproblems); //Verifies that a valid number is input, also accounts for 0 if (numproblems == 0) { cout << "You have chosen not to work any problems." << endl; PrintMenu(); cin >> input; input = MenuSelection(input); } else { while (currentproblem <= numproblems) //Do flashcards until the current problem = the number of problems you asked to work { currentproblem = CurrentProblem(currentproblem); //Outputs the problem that you are on, and increments the counter +1 correctanswer = Addition(num1, num2, correctanswer); //Generate and display a random addition problem cin >> youranswer; cout << endl; if (correctanswer == youranswer) { cout << "Correct" << endl; correct++; ttlcorrect++; totalworked++; } else { cout << "Incorrect" << endl; incorrect++; ttlincorrect++; &nbs
Explanation / Answer
x.Xlor="red">please rate - thanks you
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.