168k views
0 votes
Write a program to display a message telling the educational level of a student based on their number of years of school. The user should enter a number indicating the number of years of school, and the program should then print the corresponding message given below. Be sure to use named constants rather than any numbers other than 0 in this program.

User Abdiel
by
5.9k points

1 Answer

3 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

int years;

cout<<"enter the number of years of school: ";

cin>>years;

cout<<"The educational level is: "<<years<<endl;

}

Step-by-step explanation:

First include the library iostream in c++ program for input/output.

then create the main function and declare the variable.

after that, display the message by using cout instruction for asking the user to enter the value.

then, cin instruction store the value in the declare variable.

finally, display the message with corresponding value.

User Fmucar
by
5.2k points