I'm not used to using character values in my loops. For some reason it goes a little while. It may not be infinite, I never waited long.
#include
#include
using namespace std;
char builder_name[35];
char choice;
void add_builder()
{
while(choice != 'N' || choice != 'n')
{
ofstream builders;
builders.open ("builders.txt", ios::app);
cout << " Enter the name of a builder: ";
cin.get(builder_name, 35);
cin.ignore();
builders << builder_name << endl;
builders.close();
cout << " Would you like to add another builder? (enter (Y) or (N): ";
cin >> choice;
};
}
int main ()
{
add_builder();
return 0;
}
2007-03-14
17:40:54
·
4 answers
·
asked by
blueice_1820
2
in
Computers & Internet
➔ Programming & Design
I changed it to:
while(choice != 'N' && choice != 'n' )
I also removed the uneccessary semicolon.
It still went infinite. I then changed it to while(choice != 'N') to eliminate the two options altogether. It still went infinite. Any other ideas. It seems like a simple problem. I'm just thinking too complicated probably.
2007-03-15
06:39:47 ·
update #1