Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Simple If and If Else
Concept Learning Code Sheets
Simple If – Senior Citizen Test #1854 

Taking age as input and finding if it is greater or equal to 60.

Check for non zero input value #1859 

Take user input as a positive, negative or zero integer value and check if it is a non zero value.

Making a number absolute using If #1861 

A number is made absolute by removing its negative sign if present.

Weather Check – Multiple Instruction in If Scope #1863 

We collect weather temperature from user and do a range check, then if true will do multiple instructions in the if block scope.

Checking for Digit using if else #1865 

Collecting a char input and checking the input as a digit or a non-digit.

Stock Finished Check – If Else #1872 

Check if stock is finished using if-else selection condition

Check for alphabet – “Not an alphabet” as True Condition #1874 

Checking for user’s entry being not an alphabet first, else tell that it is an alphabet

Check for alphabet – “Is an alphabet” as True Condition #1876 

Checking for user’s entry being is an alphabet first, else tell that it is not an alphabet

Applying Discounts – Only 1 Volume Slab #1878 

Applying discounts on price based on only 1 quantity or volume of purchase based slab.

Comparing age of two friends of different age #1880 

With this program we can find who is elder amongst the friends of different age.

Userid-password match with common mismatch message #1956 

Matching of userid and password in the same condition and if not matched giving a common mismatch message.

Checking for buzz number #3176 

Test if a number is divisible by 7 or the last digit is 7, means whether the number is a buzz number.

Teens party – empty if statement #1920 

Understanding the behaviour of if when nothing is done when if condition is true.

Solved Problems
Even odd test #2012 

Write a c++ program to test if the user given integer value is an even number or an odd number.

Write a c++ program to test if the user given integer value is an even number or an odd nu ...
Output writing – If-else with post/pre increment #2014 

Write the output of the following c++ program when the user input value are -1 and 1.

int main()
{
  int n;
  cout<<"Enter and integer :";
  cin>>n;
  if(n++ >= ++n)
    cout<<n<<" if";
  else
    cout<<++n<<" else";
  return 0;
}
Write the output of the following c++ program when the user input value are -1 and 1.
Square or cube based on even check selection #3122 

Write a program which collects an integer number from the user and if the number is even it prints the square of the number else it prints its cube.

Write a program which collects an integer number from the user and if the number is even ...
Output writing – If-else ambiguities #3249 

Write output of the following code. Assume that required header files are included.

int main()
{
  int x=10,y=20;
  if(x=0) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  if(y=10) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  if(x+y==10) cout<<"Hello"<<endl;
  else cout<<"Sorry"<<endl;
  return 0;
}
Write output of the following code. Assume that required header files are included.
 ...		



Code Sheets:13  Solved Problems:4 
Back