C++ Depending on their Average Marks Assign them Streams






 

PROGRAM TO STORE NAME, ROLL NO, MARKS IN 3 SUBJECTS OF 3 STUDENTS.

DEPENDING ON THEIR AVERAGE MARKS ASSIGN THEM ENGINEERING STREAMS IF
96% AND ABOVE : COMPUTER SCIENCE
91% TO 95% : ELECTRONICS
81% TO 90% : MECHANICAL
71% TO 80% : CHEMICAL

 

#include<iostream.h>
#include<process.h>
#include<stdio.h>
class Student
{
char name[30];
int roll;
float marks[3];
float avg;
public:
void input();
void display();
}S1,S2,S3;

void Student::input()
{
cout<<“Enter Name of the student:”;
gets(name);
cout<<“Enter Roll number of the student:”;
cin>>roll;
cout<<“Enter marks(out of 100) obtained by student in 3 subjects:”;
for(int i=0;i<3;++i)
{
cin>>marks;
if(marks<0||marks>100)
{
cout<<“Wrong marks entered :”;
exit(0);
}
}
}

void Student::display()
{
cout<<“\nName : “;
puts(name);
cout<<“Roll number : “<<roll<<“\n”;
cout<<“Marks in 3 subjects : “;
for(int i=0;i<3;++i)
{
cout<<marks<<“\t”;
avg+=marks/3;
}
cout<<“\nAverage : “<<avg;
if(avg>=96)
cout<<“\nStream :Computer Science:”;
else if(avg>=91)
cout<<“\nStream : Electronics:”;
else if(avg>=81)
cout<<“\nStream :Mechanical:”;
else if(avg>=71)
cout<<“\nStream : Chemical:”;
else
cout<<“\nNo Stream Available:”;
}
void main()
{
S1.input();
S2.input();
S3.input();
S1.display();
S2.display();
S3.display();
}

Click here for more C++ Programs

info@C++

C++ (pronounced “cee plus plus”).C++ is a general-purpose,powerful programming language.C++ is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. C++ was Developed by Bjarne Stroustrup starting in 1979.C++ adds OOPS-object oriented features such as classes, and other enhancements to the C programming language.


C++ Depending on their Average Marks Assign them Streams
3 - 1 Vote




Further Reading:
http://en.wikipedia.org/wiki/Depending
http://en.wikipedia.org/wiki/Their
http://en.wikipedia.org/wiki/Average
http://en.wikipedia.org/wiki/Marks
http://en.wikipedia.org/wiki/Assign
http://en.wikipedia.org/wiki/Them

You read About: C++ Depending on their Average Marks Assign them Streams

Posted by: Prateek on October 6, 2011


Previous Post: « Next Post: »

© 2017 Trendfy. All rights reserved
Blog Managed by Prateek Jaiswal