Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ultra Easy:
- 1. cout << "gentjew";
- 2. For (int i = 700; i > 200; i = i - 13)
- cout << i;
- 3. cout << X[2-1]
- 4a. int sum;
- {for (int i = 0; i < 1001; i = i + 1)
- sum = sum + i};
- cout << sum;
- 4b. int sum;
- {for (int i = x; i < y; i = i + 1)
- sum = sum + i}
- cout << sum;
- 5. string i;
- cin << i;
- {if i == "Jack"
- cout << "Hi, Jack!" << endl
- else
- cout << "Hello, " << i << endl}
- 6a. for (int i = 0; i < 101; i = i + 1)
- {if i % 2 == 1
- cout << i << "is an odd number" << endl;
- else
- cout << i << "is an even number"; << endl}
- 6b. cout << "The following numbers are all even numbers" << endl;
- {for ( int i = 0; i < 101; i = i + 2)
- cout << i << endl}
- cout << "The following numbers are all odd numbers" << endl;
- {for ( int i = 1; i < 101; i = i + 2)
- cout << i << endl}
- 6c. already done
- 7. {for (int i = 0; i < 13; i = i + 1)
- cout << endl
- for int j = 0; j < 13; j = j + 1
- cout << i * j << " ";}
- 8. can't solve it without googling, which would be cheating, but basically you use strtok with a space as a delimiter in a loop and null to end it
- 9. int i,j,k
- i = rand()
- j = rand()
- k = rand()
- int average
- average = (i + j + k)/3
- cout << average
- {if (i > j && i > k)
- cout << i << "is the biggest number"}
- {if (j > i && j >k)
- cout << j << "is the biggest number"}
- {if (k > i && k > j)
- cout << k << "is the biggest number"}}
- repeat with reversed <> for smallest number
- 10. int grade
- string project
- cin << grade
- cin << project
- {if grade < 50
- {if project == Y
- cout << "You scored C"
- else
- cout << "You scored F"}}
- {if grade > 50 && grade < 69
- {if project = Y
- cout << "You scored B"
- else
- cout << "You scored C"}}
- etc you get the idea, just remember to cap the grades so if you get 100 you don't output all grades above 50
- 11. int X[99]
- for (int i = 0; i < 100; i = i + 1)
- X[i] = rand()%10000
- int yournumber
- cin << yournumber
- for (int i = 0; i <100; i = i + 1)
- if (yournumber == X[i])
- cout << "your number was in the list!"
- else
- cout << "your number wasn't in the list.";
- 12. cout << Welcome to higher or lower!
- int Player, oldnumber, newnumber, computerguess;
- string HL;
- while (J == 1)
- oldnumber = rand()%100
- cout << "Do you think the number will be higher, or lower next time than" << oldnumber << endl;
- newnumber = rand()%100
- cin << HL
- cout << endl << The next number is << newnumber << endl;
- {if (HL == Higher || HL == higher)
- {if newnumber > oldnumber
- cout << "You win! Continue guessing!" << endl
- else
- cout << "You lose! The computer's turn now!" << endl; J = 0}}
- {if (HL == Lower || HL == lower)
- {if newnumber < oldnumber
- cout << "You win! Continue guessing!" << endl
- else
- cout << "You lose! The computer's turn now!" << endl; J = 0}}
- While (J == 0)
- oldnumber = rand()%100
- cout << "The computer is guessing whether the number will be higher or lower than" << oldnumber << endl;
- newnumber = rand()%100
- computerguess = rand()%2
- cout << "The next number is" << newnumber << endl;
- {if (computerguess == 0)
- HL = Higher
- else
- HL = Lower}
- {if (HL == Higher || HL == higher)
- Cout << "The computer guessed Higher and he was "
- {if newnumber > oldnumber
- cout << "right! He gets another go." << endl
- else
- cout << "wrong! It's your turn now!" << endl; J = 1}}
- {if (HL == Lower || HL == Lower)
- Cout << "The computer guessed Lower and he was "
- {if newnumber < oldnumber
- cout << "right! He gets another go." << endl
- else
- cout << "wrong! It's your turn now!" << endl; J = 1}}
- follow me @realdonaldtrump or @mido9_2
Add Comment
Please, Sign In to add comment