This program puts names into a array Database_Names but when run the following comes out:
What is your Name: Martin
Do you want to put any more names in true/false: true
What is your Name: Do you want to put any more names
in true/false:What is your Name: Do you want to put any more names in true/false:What is your Name: Do you want to put any more names in true/false:What is your
and so on.
#include <iostream>
#include <string>
using namespace std;
bool more=true;
int a = 1;
bool See_the_base=true;
string Database_Names[101];
int c;
int main()
{
do
{
cout<<"What is your Name: ";
cin>>Database_Names[a];
a++;
cout<<"Do you want to put any more names in true/false: ";
cin>>more;
}
while (more==true);
cout<<"Do you want to see the database: true/false :";
cin>>See_the_base;
if (See_the_base == true)//print out the database
{
a=c;
for (int b=1;b<c;b++)
{
a=-1;
a++;
cout<<Database_Names[a]<<"/t";
}
}
else{
cout<<"end";
}
}
It just goes passed the cin>>Database_Names[a]; and even a cin.get(); command.I cant find the reason why it loops.
Thanks for any help in finding out were the loop went wrong.
This post has been edited by Binary mick: 11 November 2007 - 02:13 PM

New Topic/Question
Reply




MultiQuote





|