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

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

Output writing – If-else with post/pre increment #2014

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

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;
}

Square or cube based on even check selection #3122

Write a program which collects an integer number from the user and if the nu

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.

Output writing – If-else ambiguities #3249

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

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;
}

Code Sheets:13  Solved Problems:4 
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back