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];
    }

}

Recommended Answers

All 5 Replies

PM MattyRobot he made be able to help you!

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

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..

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.