Advertisement
DrDiagramm

Untitled

Feb 11th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <iostream>
  2. int asking();
  3. void perf(int a);
  4. void result(int j);
  5.  
  6. int main() {
  7. int score = asking();
  8. result(score);
  9. perf(score);
  10. system("pause");
  11. return 0;
  12. }
  13.  
  14. int asking() {
  15. int x;
  16. bool valid = true;
  17.  
  18. while (valid) {
  19. std::cout << "What was your Score?\n";
  20. std::cin >> x;
  21. if (x >= 0 && x < 101) {
  22. valid = false;
  23. }
  24. else {
  25. std::cout << "The Score must be between 0 and 100!\n";
  26. }
  27. }
  28. return x;
  29. }
  30. void result(int i) {
  31. if (i<101 && i>89) {
  32. std::cout << "A Score!\n";
  33. }
  34. else if (i < 90 && i>79) {
  35. std::cout << "B Score!\n";
  36. }
  37. else if (i < 80 && i>69) {
  38. std::cout << "C Score!\n";
  39. }
  40. else if (i < 70 && i>59) {
  41. std::cout << "D Score!\n";
  42. }
  43. else if (i < 60 && i >= 0) {
  44. std::cout << "F Score!\n";
  45. }
  46. else {
  47. std::cout << "Invalid Score! (0-100)\n";
  48. }
  49. }
  50. void perf(int j) {
  51. if (j == 100) {
  52. std::cout << "Perfect Score!\n";
  53. }
  54. else {
  55. std::cout << " ";
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement