if esle

Q1)
#<include<iostream>
using namespace std;
void main( )
{
char year;
float gpa;
cout << "What year student are you ?" << endl;
cout << "Enter 1 (freshman), 2 (sophomore), 3 (junior), or 4
(senior)" << endl << endl;
cin >> year;
cout << "Now enter your GPA" << endl;
cin >> gpa;
if (gpa >= 2.0 && year == '4')
cout << "It is time to graduate soon" << endl;
else if (year != '4'|| gpa <2.0)
cout << "You need more schooling" << endl;
}

Q2)
#<include<iostream>
using namespace std;
void main( )
{
float average;
cout << "Input your average:" << endl;
cin >> average;
if (average > 60)
cout << "You Pass" << endl;
if (average < 60)
cout << "You Fail" << endl;
}

No comments:

Post a Comment