Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Easy Questions
- 1. int suit, number;
- for (int i = 0; i < 2; i = i + 1)
- suit = rand()%4+1
- number = rand()%13+1
- if (number == 1)
- cout << "You drew the Ace of";
- if (number == 11)
- cout << "You drew the Jack of";
- if (number == 12
- cout << "You drew the Queen of";
- if (number == 13)
- cout << "You drew the King of";
- if (number > 1 && number < 11)
- cout << "You drew the" << number << "of";
- if (suit == 1)
- cout << " Spades";
- ##etc for other suits
- 2. int time = 9999
- int SS = time %60
- int MM = time /60
- time = time - SS
- int MM = time %60
- int HH = time/60
- cout << HH << ":" << MM << ":" << SS
- 3. int resultA, resultB, resultC;
- int coinA, coinB;
- for (int i = 0; i < 1001; i = i + 1)
- {coinA = rand()%2
- coinB = rand()%2
- if (coinA+coinB == 0)
- resultA = resultA + 1;
- if (coinA+coinB == 1)
- resultB = resultB + 1;
- if (coinA+coinB == 2)
- resultC = resultC + 1;}
- float percentageA, percentageB, percentageC;
- percentageA = (resultA/1000)*100
- percentageB = (resultB/1000)*100
- percentageC = (resultC/1000)*100
- cout << "The percentage of two heads was" << percentageA
- cout << "The percentage of two tails was" << percentageB
- cout << "The percentage of one head and one tail was" << percentageC
- 4. int C[14]
- for (int i = 0; i < 5; i = i +1)
- C[i] = A[i]
- for (int i = 0; i < 10; i = i+1)
- C[i+5] = B[i]
- 5. int money;
- float interest;
- int x; (years)
- for (int i = 0; i < x; i = i + 1)
- money = money * (interest+1)
- 6. int X[199];
- int tempstorage;
- for (int i = 0; i < 200; i = i + 1)
- X[i] = rand()%11
- for (int i = 0; i < 200; i = i + 1)
- for (int j = 0; j < 200; j = j + 1)
- if X[j] < X[i]
- {tempstorage = X[i];
- X[i] = X[j];
- X[j] = tempstorage;}
- (same for the other list, just swap the <> direction)
- I'm too lazy to do the mode one.
- 7. int A, B, C;
- float C
- cin << A << B
- while (A > 0)
- {if (A - B < 0)
- {D = A;
- break;}
- A = A - B
- C = C + 1
- }
- cout << "The result of the division is" << C << "with a remainder of" << D
- 8. int roman;
- cin << roman;
- if roman == 10
- cout << "X"
- if roman > 5
- {cout << "V";
- roman = roman - 5;
- if (roman == 4)
- cout << "IV"
- else
- while (roman > 0)
- {cout << "I";
- roman = roman - 1;}}
- if roman == 5
- cout << "V"
- if roman < 5
- {if roman == 4
- cout << "IV"
- else
- while (roman > 0)
- {cout << "I";
- roman = roman - 1;}}
- 9. ##num1 and num2 are the two integers to be added, num5 is the final number, the rest are for code usage
- int num1, num2, num3, num5;
- float num4;
- num4 = num1;
- ##counting the number of digits by dividing by 10 until the number is a decimal
- while (num4 > 1)
- {num3 = num3 + 1;
- num4 = num4 /10;}
- num5 = num1 + (num2 * pow(10,num3))
- cout << num5
- 10. Don't know how to do this.
- 11. I haven't the slightest clue how this maths.
- 12. for (int i = 0; i < 1000; i = i + 1)
- for (int j = 0; j < 1000; j = j + 1)
- if ( i != j && X[i] == X[j])
- cout << "The repeated number was << cout << X[i];
- follow me @realdonaldtrump or @mido9_2 (I have no tweets, this is just a watermark)
Add Comment
Please, Sign In to add comment