Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int asking();
- void perf(int a);
- void result(int j);
- int main() {
- int score = asking();
- result(score);
- perf(score);
- system("pause");
- return 0;
- }
- int asking() {
- int x;
- bool valid = true;
- while (valid) {
- std::cout << "What was your Score?\n";
- std::cin >> x;
- if (x >= 0 && x < 101) {
- valid = false;
- }
- else {
- std::cout << "The Score must be between 0 and 100!\n";
- }
- }
- return x;
- }
- void result(int i) {
- if (i<101 && i>89) {
- std::cout << "A Score!\n";
- }
- else if (i < 90 && i>79) {
- std::cout << "B Score!\n";
- }
- else if (i < 80 && i>69) {
- std::cout << "C Score!\n";
- }
- else if (i < 70 && i>59) {
- std::cout << "D Score!\n";
- }
- else if (i < 60 && i >= 0) {
- std::cout << "F Score!\n";
- }
- else {
- std::cout << "Invalid Score! (0-100)\n";
- }
- }
- void perf(int j) {
- if (j == 100) {
- std::cout << "Perfect Score!\n";
- }
- else {
- std::cout << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement