hey guys !! my professor want me to create a c++ program using nested if .. can u please help . I am a beginner | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

hey guys !! my professor want me to create a c++ program using nested if .. can u please help . I am a beginner

c++ program using nested if

13th Jun 2016, 3:58 AM
priyankaa
5 Answers
+ 2
You can try making a program somewhat like this: Get user input for experience of the person Get user input for what is the persons' salary // program if(exp<3) // if exp is less than 3 if(sal<5000) // if salary is less than 5000 cout<<"Salary ="<<sal+bon*2; if(exp>3) if(sal>5000) cout<<"Salary ="<<sal+bon*3; // You can expand your program in this way // keep on adding conditions // all the best 👍
13th Jun 2016, 4:44 AM
Satan 666
Satan 666 - avatar
+ 2
You can also make a program to find maximum number out of three in following way: #include<iostream> using namespace std; int main() { int a,b,c; cout<<"Enter any three numbers:"; cin>>a>>b>>c; if (a>b) { if(a>c) { cout<<" Maximum number is:"<<a<<endl; return 0; } } if (b>a) { if(b>c) { cout<<"Maximum number is :"<<b; return 0; } } cout<<"Maximum number is :"<<c; return 0; } however, There are many ways to find maximum number other than this but it is using nested if.
13th Jun 2016, 5:44 AM
Vishal Koshti
Vishal Koshti - avatar
+ 1
thank u both of u
30th Jun 2016, 4:09 PM
priyankaa
+ 1
really a great help
30th Jun 2016, 4:09 PM
priyankaa
+ 1
you're welcome
5th Aug 2016, 7:10 AM
Vishal Koshti
Vishal Koshti - avatar