-1

this function needs to ask for a persons name, phone number, and email. BUT it only needs to do this once at a time because it returns to a menu and asks if they want to add more people. I need a way to increment count by 1 each time it re-enters the void function. I was thinking of a for loop in the main, but idk how or if that would work

void add(char name[][32],char number[][9],char email[][32],int PEOPLE)
{
    int count;

    {
        cout << "enter their name\n";
        cin >> name[count];
        cout << "enter their number\n";
        cin >> number[count];
        cout << "enter their email\n";
        cin >> email[count];
    }

}

Edited by Nick Evan: Fixed formatting

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by tkud
0

nevermind i figured it out. used an if statement in the main! thanks for looking

0
void add(char name[][32],char email[][32],int people){
int x=1,count=0;
while(x==1){
cout<<"Name:";
cin>>name[count];
cout<<endl<<"Email:";
cin>>email[count];
cout<<endl<<endl;
people++;
cout<<"Do you want to add more people's info?(0)No,(1)Yes";
cin>>x;
}

This should do..

-2

You can now mark this thread as sloved, since you got it already .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.