February 9th, 2013, 11:04 AM
c++ Random linked strings
Hey people, i'm new to this forum. I want to make a funny and simple game in cmd with visual studio and here is my plan, here are the steps that I wanna accomplish:
The program asks the person for
1: 4 girl names
2: 4 boy names
3: What they do? (4 actions)
4: Where they do this? (4 locations)
5: Random linked things
And from here I want to randomly get 1 line of a random girl name + random boy name + random action + random place.
and followed by the second, third, and fourth line of random chosen things.
Girl 1 - Boy 3 - Action 2 - Location 4;
Girl 3 - Boy 4 - Action 4 - Location 1;
Girl 2 - Boy 1 - Action 3 - Location 3;
Girl 4 - Boy 2 - Action 1 - Location 2;
And it can get funny like: Amber and John are jumping from a bridge. a game where you can play with your friends and have fun.
Here is my code so far:
int main (void)
cout << "Welcome!\n\n";
cout << "Type 4 girl names.\n";
string g1, g2, g3, g4;
cin >> g1;
cin >> g2;
cin >> g3;
cin >> g4;
cout << "Type 4 boy names.\n";
string b1, b2, b3, b4;
cin >> b1;
cin >> b2;
cin >> b3;
cin >> b4;
cout << "\nWhat they do?\n";
string action1, action2, action3, action4;
getline (cin, action2);
getline (cin, action3);
getline (cin, action4);
cout << "\nWhere is happening?\n";
string loc1, loc2, loc3, loc4;
getline (cin, loc2);
getline (cin, loc3);
getline (cin, loc4);
int randomNr1 = rand() % 120 +1;
And from here I don't know what to do!!
please help me
Also I'm a beginner at c++ so my code could be poor made.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.