@ZControls_Games/

DrabSalmonDowngrade

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
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
55
#include <iostream>
using namespace std;
int main(){
  cout << "Hello World! My guess is between 1-10 and you have 5 tries.\n";
  int luckyNum = 7; // The correct guess
  int tries = 5; // Number of tries
  int num1;  // first guess
  int num2; // second guess
  int num3; // third guess
  int num4;//fourth guess
  int num5; //fifth guess
  while (int tries = 5){
  cout << "Enter your guess:" << endl;

  cin >> num1;
  if (num1 == 7)
    cout << "You got the correct guess";
    break;}
  if (num1 != 7){
  cout << "Enter your second guess:" << endl;
  cin >> num2;}
  if (num2 == 7){
    cout << "You got the correct guess";
    
    }
  if (num2 != 7){
    cout << "Enter your third guess:" << endl;
    cin >> num3;
  }
  if (num3 == 7){
    cout << "You got the correct guess";

  }
  if (num3 != 7){
    cout << "Enter your fourth guess: " << endl;
    cin >> num4;
  }
  if (num4 ==  7){
    cout << "You got the correct guess";
  }
  if (num4 != 7 ){
    cout << "Enter your fifth and last guess:" << endl;
    cin >> num5;
  }
  if (num5 == 7)
  cout << "That was a close one. You won!" << endl;
  else if (num5 != 7){
    cout << "You ran out of guesses" << endl;
    cout << "Unlucky." << endl;
  }
  }