Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int main()
- {
- cout << "Do you think that you're a psychic?" << endl;
- cout << "Try and guess the correct sequence of shapes that appear!" << endl;
- cout << "Type in one of these shapes: Circle, Cross, Wave, Square, or Star\n" << endl;
- srand (time(NULL));
- string deck[5] = {"Circle", "Cross", "Wave", "Square", "Star"};
- int RandIndex = rand()%5;
- string solution = deck[RandIndex];
- string guess;
- while(true){
- cout << "Please enter a card: " << endl;
- getline(cin, guess);
- cout << "\n" << endl;
- cout << "The card you picked was: " << guess << endl;
- cout << "The card the computer picked was: " << solution << endl;
- if(guess != solution){
- cout << "You failed!" << endl;
- }
- else {
- cout << "You got one! Good job!" << endl;
- }
- srand (time(NULL));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement