Here is a program that creates a student structure with name, roll, mark, and remark members. The program reads in data from the user, calculates the remark based on the student's marks, and displays all the information back to the user.
In this program, we first define the student structure with name, roll, mark, and remark members. We then declare a variable of type student named s.
Next, we read in the student data using std::cin and std::getline(). We read the name using std::getline() to allow for spaces in the name.
We then calculate the student's remark based on their marks. If the student has 40% or more marks, their remark is set to 'P', otherwise it is set to 'F'.
Finally, we display all the student data back to the user using std::cout.
Here is an example of the program in action:
No comments:
Post a Comment
If you have any doubts, please let me know