Computer Programming Learning Part-08||Project-01||Calculating grade points with C++ programs.
Steemian Friends,
Today, I will write Computer Programming Learning Part 08. I will create some small projects with C++ programs. Today, I will write a C++ program to get students' grade results. Hopefully, everyone who reads my writing will be able to create a program to calculate grades using C++.
I first write the C++ program on white paper because it is convenient to write on the computer. If I make a mistake while writing on paper, I can correct it while writing on the computer.
I first open the computer and the Code Blocks software. Then I click on File. Then I click on Empty File from New File. Then, I see a code-writing page, shown as a red block in the image below.
Then, I declared the C++ program's header file and main function. Every C++ program must first declare these. Below, I have declared the header file and main function.
int main()
{
}
Then, I will create my main program. I will declare an integer variable to generate the student's result grade. Then, I wrote code to store the result. I have written it below.
int mark;
Cout<<"Enter Mark:";
Cin>>Mark;
Then, I used a condition called if. If there are more than 100 marks, this condition will show an Invalid Mark result. I have written it below.
if(Mark>100)
{
Cout<<"Invalid Mark";
}
Then I used another condition called if else. If you get marks less than zero through this condition, it will show an Invalid Mark. I have written it below.
else if(Mark<0)
{
Cout<<"Invalid Mark";
}
Then I use the else if condition: if I get more than or equal to 80 marks, then it will show A+ as output. I have written it below.
else if(Mark>=80)
{
Cout<<"A+";
}
Then again, I used a condition that will show an A grade result if marks are equal to or above 70. I have written it below.
else if(Mark>=70)
{
Cout<<"A";
}
Then, I applied another condition, which will show an A-grade result if marks are equal to or above 60. I have written it below.
else if(Mark>=60)
{
Cout<<"A-";
}
Then, I applied another condition, which will show a B grade result if marks are equal to or above 50. I have written it below.
else if(Mark>=50)
{
Cout<<"B";
}
Then, I applied another condition, which will show a C grade result if marks are equal to or above 40. I have written it below.
else if(Mark>=40)
{
Cout<<"C";
}
Then, I applied another condition, which would show a D grade result if marks were equal to or above 33. I have written it below.
else if(Mark>=33)
{
Cout<<"D";
}
Then, I applied a condition: marks below 33 will show the result as Fail. I have written it below.
else
{
Cout<<"Fail";
}
Then I click the Run option and see the program's output. There was an error in writing my program, which I fixed. Then, a black page appears to view the output. Here, I type 70 and click enter. I see my desired result, an A grade. I have shown it in the red block below.
I am very happy to see the program's output. You can also create such a program by writing my program step by step.
Link to my previous post:
Part-01 | Part-02 | Part-03 | Part-04 | Part-05 | Part-06 | Part-07 |
---|
Thank you, friend!


I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.
This is my Twitter share link :
https://twitter.com/mahadih83660186/status/1826200684234174904?t=ND6dEC5b6OdSnjH4f1QCUQ&s=19
We support quality posts and good comments Published in any community and any tag.
Curated by : @solaymann
Thank You Dear Sir...