Problem with number finding code

I need a program to find the largest number out of a known set of numbers for A (I got that part working correctly, and the smallest number for an unset amount of for B and C to quit, my problem is when it comes to B, I can't get it to show the smallest number, it'll always show 0 if it's not below -99, this is the code i got so far.

/code/

#include <iostream>
#include <string>

using namespace std;

int main()
{
string input;
int scanNum, bigNum = 0;
int i;
int enteredNum;
const int sentinel = -99;

cout << "Please enter one of the following. \n A - Find the largest # with a known quantity of numbers. \n B - Find the smallest # with an unknown quantity of numbers. \n C - Quit. \n" << endl;

cin >> input;

if (input=="A" || input=="a")
{
cout << "Please enter the amount of numbers you want to enter" << endl;

cin >> enteredNum;

for (i = 0; i < enteredNum; i = i++)
{
cin >> scanNum;
{
if (scanNum > bigNum)(bigNum = scanNum);
}
}
cout << "Your largest integer is " << bigNum << " . " << endl;
}
else if (input=="B" || input=="b")
{
scanNum = 999;

cout << "Please enter your numbers, end it by entering -99." << endl;

while (scanNum != -99)
{
cin >> scanNum;
if (scanNum != -99)
{ if (scanNum < bigNum)
{ scanNum = bigNum;
}
}
}

cout << "Your smallest integer is " << bigNum << " . " << endl;
}
}

/code/
scanNum = bigNum is backwards; try bigNum = scanNum.
That'll give me a working negative integer but positives will still show up as 0.
Nevermind, this is the working code.

\code\

#include <iostream>
#include <string>

using namespace std;

int main()
{
string input;
int scanNum, bigNum = 0;
int i;
int enteredNum;
const int sentinel = -99;
int newVar;
int smallNum = 1000;

cout << "Please enter one of the following. \n A - Find the largest # with a known quantity of numbers. \n B - Find the smallest # with an unknown quantity of numbers. \n C - Quit. \n" << endl;

cin >> input;

if (input=="A" || input=="a")
{
cout << "Please enter the amount of numbers you want to enter" << endl;

cin >> enteredNum;

for (i = 0; i < enteredNum; i = i++)
{
cin >> scanNum;
{
if (scanNum > bigNum)(bigNum = scanNum);
}
}
cout << "Your largest integer is " << bigNum << " . " << endl;
}
else if (input=="B" || input=="b")
{
scanNum = 999;

cout << "Please enter your numbers, end it by entering -99." << endl;

while (scanNum != -99)
{
cin >> scanNum;
if (scanNum != -99)
newVar = 999999999999999999;
if (scanNum != -99){newVar = scanNum;}
{ if (newVar < smallNum)
{ smallNum = newVar;
}
}
}

cout << "Your smallest integer is " << smallNum << " . " << endl;
}
}

\code\
Nah, got a new problem, for some reason I can't get it to close now.

/code/

#include <iostream>
#include <string>

using namespace std;

int main()
{
string input;
int scanNum, bigNum = 0;
int i;
int enteredNum;
const int sentinel = -99;
int newVar;
int smallNum = 1000;
string input2;

while input!="C"
{
cout << "Please enter one of the following. \n A - Find the largest # with a known quantity of numbers. \n B - Find the smallest # with an unknown quantity of numbers. \n C - Quit. \n" << endl;

cin >> input;

if (input=="A" || input=="a")
{
cout << "Please enter the amount of numbers you want to enter" << endl;

cin >> enteredNum;

for (i = 0; i < enteredNum; i = i++)
{
cin >> scanNum;
{
if (scanNum > bigNum)(bigNum = scanNum);
}
}
cout << "Your largest integer is " << bigNum << " . " << endl;

}
else if (input=="B" || input=="b")
{
scanNum = 999;

cout << "Please enter your numbers, end it by entering -99." << endl;

while (scanNum != -99)
{
cin >> scanNum;
if (scanNum != -99)
newVar = 999999999999999999;
if (scanNum != -99){newVar = scanNum;}
{ if (newVar < smallNum)
{ smallNum = newVar;
}
}
}

cout << "Your smallest integer is " << smallNum << " . " << endl;
}

if input (input=="C" || input=="c");
{
cout << "Press any key to terminate the program." << endl;
return 0;
}
}
}

/code/
Hint: there's an extra semicolon.
I still can't get it
while (input != 'C')

just make input a char. that might be it?
Topic archived. No new replies allowed.