C++ : read marks obtained in your final exams in all subjects and find total marks, percentage, results (pass or fail), division


#include<iostream>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
using namespace std;

int main()
{
float os,ca,cpp,mgnt,nm;
cout<<"Enter the marks sequently in the below given subjects.\n\n";
cout<<"Operating System\nComputer Architecture\nC++\nIntro. to Management\nNumerical Methods\n";
cin>>os>>ca>>cpp>>mgnt>>nm;

float total=os+ca+cpp+mgnt+nm, per;
string result,div;

if(os>=40 && ca>=40 && cpp>=40 && mgnt>=40 && nm>=40)
{
            result="Pass";
per=total/5;
}

else
{
        result="Fail" ; div="n/a"; per =0;
}
   

if(result=="Pass")
   {
if(per>=80)
{
                div="Distinction";
   goto end;
}
else if(per>=60)
   {
                div="First";
                goto end;
}
else if(per>=50)
   {
div="Second";
goto end;
}
else
   {
div="Third";
goto end;
}
}
end:
system("cls");
cout<<"\n\n\n\n\n==========================================================================\n";
cout<<"Marks in Operating System : "<<os<<"\n";
cout<<"Marks in Computer Architecture : "<<ca<<"\n";
cout<<"Marks in C++ : "<<cpp<<"\n";
cout<<"Marks in Intro. to Management : "<<mgnt<<"\n";
cout<<"Marks in Numerical Methods : "<<nm<<"\n\n";
cout<<"Total Marks : "<<total<<"\n";
cout<<"Percentage : "<<per<<" %\n";
cout<<"Result : "<<result<<"\n";
cout<<"Division : "<<div<<"\n";
    cout<<"==========================================================================\n";
getch();
return(0);

}

No comments:

Post a Comment