Before I get started with this question I would like to point out that this is a small app I am creating to not only learn more C++ coding but also to choose who drives the fifth day in my carpool group for college.
I am creating an application in C++ that lets the user enter some people's names and it chooses one of those people at random every time you enter the text "Go" (minus the ""). I have all the text printed out and I also have it where it stores the people as a string but I can not figure out how to choose one of the strings at random. Here is my code so far:
#include <cstdlib>
#include <iostream>
using namespace std;
string a = "Jimmy";
string b = "Nathan";
string c = "Cochran";
string d = "Harris";
int main(int argc, char *argv[])
{
cout<<"Current Car Pool Riders/Drivers\n";
cout<<endl;
cout<<"1.) Jimmy\n";
cout<<"2.) Nathan\n";
cout<<"3.) Cochran\n";
cout<<"4.) Harris\n";
cout<<endl;
cout<<"Type Go and Press Enter to See Who Drives the Fifth Day\n";
cout<<endl;
cin>>a;
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Please note I am an ABSOLUTE beginner at C++ and decided to pick it up because my friends are taking it in college. But I am very proficient with Visual Basic and C Sharp.
Thanks for the help and I hope to get a reply very soon because I need this to see who drives to college tomorrow :)