Recent

recentposts

Condition and Type conversion

Condition Statement

Condition Statement is similar to if-else statement but it is the short form of if-else .

Syntax :

(condition) ? statement1 : statement2 ;






Program to find whether the number is greater than 0 or not .

#include<iostream.h>

#include<conio.h>


void main(){


clrscr() ;

int numb ;


cout<<”\n Enter the number - ” ;

cin>>numb ;


( numb >0 ) ? ( cout<<” Positive number ” ) : (cout<<”Negative number ” ) ;


getch() ;

}

Program to find whether the number is divisible by 13 .

#include<iostream.h>

#include<conio.h>


void main(){


clrscr() ;

int numb ;


cout<<”\n Enter the number - ” ;

cin>>numb ;


( numb % 13 == 0 ) ? ( cout<<” Divisible ” ) : (cout<<” Not Divisible ” ) ;


getch() ;

}

Type Conversion and Type Casting

Type Conversion : The process of converting one predefined type into another is called Type Conversion. This type of conversion took place automatically .

Type Casting : The process of forceful conversion of one predefined type into another by user is called Type Casting. This type of conversion is forceful conversion .

For  type casting , user have to mention the datatype into which the conversion should take place.


__________________________________________________________________________




SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Please give your valuable suggestions