I am working on a problem where I need to use an array of strings to store email addresses. The user of the program should be able to list all the email addresses, delete an email address, search an email address and list all email addresses. I am stuck on how to enter multiple addresses into the array to that they can be worked with.
Here is what I have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
#include <cstring>
usingnamespace std;
int main ()
{
char eAddress[80] = {};
// Prompt user for an email address
cout << "Email Address? " << endl;
cin.getline(eAddress, 80);
cout << eAddress << endl;
system("pause");
return 0;
}
I can get the program to accept the input from the user, store the address in the array (80 chars max) and then print it back out to the screen. How do I get the array to accept multiple addresses and store them for use? Do I use a multi-dimensional array?
hm... you used C-style strings.. ie char arrays...
you'd better use C++ style strings by including <string>
also, i would prefer a vector of string rather than array...
so... the solution by Athar will help you..
if you would like to stick to C-style array, you have to use a multidimensional array..
char adresses[200][80] // to make an array containing 100 emails each of size 80
I need help in storing the email addresses below, delete them or do a search. Should I be storing them on a file on my computer to call the function. Please help!!!!!!!!!!!!!!!
#include <iostream>
#include <string>
#include <vector>
using namespace std;
Shoud my program look like this: My goal is to call the email addresses from the string to have the users to choose whether they want to list the email address which is number 3
#include <iostream>
#include <string>
#include <vector>
using namespace std;
I really think you should avoid using recursion like that (calling processMenu() from within processMenu()). It would be much better to use a while() loop instead.