From 5205d3d77bb3327af401952692a859f7c87882f2 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Mon, 19 Feb 2024 17:04:17 -0800 Subject: char strings set up --- Project1/contacts.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Project1/contacts.cpp') diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 5925152..0dcead9 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -26,19 +26,19 @@ char addNew(contact newContact[], size_t MAX, int t) { for (int i = t; i < MAX; i++) { - cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; newContact[i].id = i + 1; newContact[i].count = t; + cout << "Please enter each piece of information when you are prompted to" << endl; cout << "enter name: " << endl; - cin >> newContact[i].Name; + cin.getline(newContact[i].Name, 25); cout << "enter Email: " << endl; - cin >> newContact[i].Email; + cin.getline(newContact[i].Email, 100); cout << "enter Street Address: " << endl; - cin >> newContact[i].StreetAddress; + cin.getline(newContact[i].StreetAddress, 35); cout << "enter city: " << endl; - cin >> newContact[i].City; - cout << "enter State: " << endl; - cin >> newContact[i].State; + cin.getline(newContact[i].City, 30); + cout << "enter State as two letter abbreviation: " << endl; + cin.getline(newContact[i].Name, 5); cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; cin >> newContact[i].Zip; @@ -64,18 +64,18 @@ void update(struct contact newContact[], size_t MAX) int t = c - 1; for (int i = t; i < MAX;) { - cout << "Please enter all inputs as english characters with underscores (_) for spaces" << endl; + cout << "Please enter each piece of information when you are prompted to" << endl; newContact[i].id = c; cout << "enter name: " << endl; - cin >> newContact[i].Name; + cin.getline(newContact[i].Name, 25); cout << "enter Email: " << endl; - cin >> newContact[i].Email; + cin.getline(newContact[i].Email, 100); cout << "enter Street Address: " << endl; - cin >> newContact[i].StreetAddress; + cin.getline(newContact[i].StreetAddress, 35); cout << "enter city: " << endl; - cin >> newContact[i].City; - cout << "enter State: " << endl; - cin >> newContact[i].State; + cin.getline(newContact[i].City, 30); + cout << "enter State as two letter abbreviation: " << endl; + cin.getline(newContact[i].Name, 5); cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; cin >> newContact[i].Zip; -- cgit v1.2.3