Hello GonlyG,
Here is the answer to your problem
I wish I could make the underscore/cursor blink like on the screen, but like your program it is waiting for input, but you have no idea what to type in.
Sometimes mixing C and C++ code does not work well. I would like to tell you that you are missing the <string.h> header file, but you did not include your header files, so I do not know.
In the short time I did spend with the program I did come up with this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
int main()
{
int inputs;
std::vector <std::string> names;
std::vector <std::string> status;
std::vector <std::string> travel;
//std::string travels; // <--- Not needed.
std::cout << "\n Enter number of lines to input: ";
std::cin >> inputs;
std::cout << "\n Enter Name, Status, Itinerary";
std::cout << "\n Example (Andy, sick abc-def-ghi-jkl ...): " << std::endl;
for (int i = 0; i < inputs; i++)
{
//name, status, itinerary
std::string name, condition, itinerary;
std::cout << "\n Enter person " << i + 1 << ". : ";
std::cin >> name >> condition >> itinerary;
names.push_back(name);
status.push_back(condition);
travel.push_back(itinerary);
//get rid of the dashes and put it in an array
//travels[i] = strtok(travels[i], "-");
replace(travel[i].begin(), travel[i].end(), '-', ' '); // <--- include <algorithm> header file,
//std::cout << "got here" << std::endl; //this line isn't printed
}
// <--- Added for testing.
for (int lc = 0; lc < inputs; lc++)
{
std::cout << "\n " << names[lc]
<< ' ' << status[lc]
<< ' ' << travel[lc] << std::endl;
}
std::cout << "\n Program finished";
return 0;
}
|
This is one possible solution.
I am think of creating a struct and only needing one vector of structs to hold all the information. I will play with that shortly.
Tip: use better names for your variables not "a", "b", "c". See above code.
Hope that helps,
Andy