- Joined
- Jul 11, 2004
- Messages
- 1,125
- Location
- oh... I'm around
- Main Job

- Secondary Job

- Third Job

- Linkshell
- BigFunn
ok so I'm in a C++ programming class. On my most recent assignment I am encountering a problem that I need to know the solution to.
The Code
the problem is, when I try to enter 0 to end the program I get one of these(note had to find this with google images since I don't have access to photobucket at school):
now after I end that, the program finishes fine, my teacher can't figure out what is wrong, we have tried redoing it in a new instance of Microsoft Visual Studio, got the same error at the same time. Now while she is fine with just letting me turn it in, I'm not, I want to know what is causing the problem... but as I can see nothing wrong I turn to anyone of you who may see something me and my teacher don't.
The Code
Spoiler:
Code:
//Georgebobbilly
//Chapter 8 Handout, Exercise 2
//Determine the largest number that evenly devides into a number
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
//declare variables
int max;
int mod;
int dev;
//initial input for max
cout << "Input the integer: ";
cin >> max;
//do statement
do
{
//initial calculations
dev = max / 2;
mod = max % dev;
//nested while statement
while(mod != 0)
{
dev = dev -1;
mod = max % dev;
}//end while
//output
cout << endl << endl;
cout << max << "'s highest number that can be evenly devided into it is " << dev;
cout << endl;
//Get new number for max
cout << "Input integer (input 0 to end): ";
cin >> max;
}while(max >= 0);
return 0;
}//end main
the problem is, when I try to enter 0 to end the program I get one of these(note had to find this with google images since I don't have access to photobucket at school):
Spoiler:
now after I end that, the program finishes fine, my teacher can't figure out what is wrong, we have tried redoing it in a new instance of Microsoft Visual Studio, got the same error at the same time. Now while she is fine with just letting me turn it in, I'm not, I want to know what is causing the problem... but as I can see nothing wrong I turn to anyone of you who may see something me and my teacher don't.