Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ switch integer

int testScore;                     
    cout <<"Enter your test score and I will tell you 
";
    cout <<"the letter grade you earned ";
    cin >> testScore;

    switch(testScore/10)
{ 
    case 10:
    case 9:
        cout <<"Your grade is A.
";
    break;
    case 8: 
        cout <<"Your grade is B.
";
    break;
    case 7: 
        cout <<"Your grade is C.
";
        break;
    case 6: 
            cout << "Your grade is D.
";
        break;
    case 5: 
            cout << "Your grade is F.
";
        break;

    default:
        cout << "That score isn’t valid
";

    }
Comment

PREVIOUS NEXT
Code Example
Cpp :: What will be the values of variables p, q and i at the end of following loop? int p = 5; int q = 18; for(int i=1;i&lt;5;i++) p++; --q; 
Cpp :: Arduino Access Point ESP8266 
Cpp :: npm wasm 
Cpp :: temporary variable ex c++ 
Cpp :: 1281. Subtract the Product and Sum of Digits of an Integer leetcode solution in c++ 
Cpp :: construct string with repeat limit 
Cpp :: convert c++ program to c online 
Cpp :: skip headers while reading text 
Cpp :: Change Font ImGui 
Cpp :: C++ system("pause") 
Cpp :: typeid to string c++ 
Cpp :: initializer before void c++ 
Cpp :: c++ sleep function 
Cpp :: FINAL CODES_MY_OS_LAB 
Cpp :: max stack 
Cpp :: c++ loop vector iterator 
Cpp :: fenwick tree 
Cpp :: c++ do you not inherit constructor 
Cpp :: C++ Assignment Operators 
Cpp :: accumulate in c++ 
Cpp :: c++ short hand if else 
C :: pi in c language 
C :: factorial in c 
C :: octave dot operator 
C :: curl authorization header 
C :: windeployqt example 
C :: libdvd-pkg: `apt-get check` failed 
C :: c bit access struct 
C :: c fork wait for child 
C :: fopen function in c 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =