i cannot figure out why my code is not working. i have tried everything that i could read or watch. as this is a home work ass please do not modify it for me but just point me in the right directio with suggestions, thanks
Code:#include <iostream> #include <string> #include <iomanip> using namespace std; int main() { char letter; // users menu choice int num; // the number of numbers that the user wants to enter int num1; // user inputed variables int ans; // largest variable int answ; // smallest variable cout << " Please type in your choice by entering a b or c " << endl; cout << " a= Find the largest number with a known quantity of whole two digit numbers " << endl; cout << " b= Find the smallest number with an unknown quantity of numbers " << endl; cout << " c= Quit " << endl; cin >> letter; if (letter == 'a') { cout << "How many numbers would you like to enter? " << endl; cin >> num; cout << "Please enter a number and press enter. " << endl; cout << endl; ans = 0; int count; // declaring loop control variable for (count = 0; count < num; count = count++) { cin >> num1; ans = num1; cin >> num1; if (num1 > ans) { ans = num1; cin >> num1; } else if (ans > num1) { ans = ans; cin >> num1; } } cout << "The Largest number you entered was " << ans << endl; cout << endl; return main(); } else if (letter == 'b') { cout << " Enter as many numbers as you like, when you are finished enter '99' " << endl; cout << endl; answ = 0; while (answ != 99) { cin >> num1; answ = num1; cin >> num1; if (num1 < answ) { answ = num1; cin >> num1; } else if (answ < num1) { answ = ans; cin >> num1; } } cout << "The smallest number you entered was " << answ << endl; cout << endl; } system("pause"); return 0; }



LinkBack URL
About LinkBacks



