Posts

Showing posts from June, 2023

IF & ELSE CONDITION STATEMENTS

  #include <iostream> #include <iomanip> using namespace std ; //..................IF-ELSE-CONDITION............// int main (){     cout << "This is tutorial 9 if-else conditions and conditinal statements" << endl ;     int age ;     cout << "Tell me your age" << endl ;     cin >> age ;     if ( age > 18 ){         cout << "You can come to my party" << endl ;     }     else if ( age == 18 ){         cout << "You can come to my party" << endl ;     }     else {         cout << "Sorry you are too young for this party" << endl ;     }     return 0 ; } //...............SELECTION CONTROL STRUCTURE.............//

CONSTANTS , MANIPULATORS & PERCEDENCE

  #include <iostream> #include <iomanip> using namespace std ; int main (){     int a = 10 ;     cout << "The value of a was " << a << endl ;     a = 30 ;     cout << "The value of a is " << a << endl ;     //.........................CONSTANTS iN C++...............................//     const int x = 10 ;     //.........................MANIPULATORS...................................//     int m = 1 ;     int n = 20 ;     int o = 1000 ;     cout << "The value of m without setw is " << m << endl ;     cout << "The value of n without setw is " << n << endl ;     cout << "The value of o without setw is " << o << endl ;     cout << " \n " ;     //.........................WITH SETW....................................//     cout << "The valu of m is " << m << setw ( 4 ) << endl ;     c

REFRENCE VARIABLES & TYPECASTINGS

  #include <iostream> using namespace std ; int main (){     int a , b , c ;     cout << "Enter the value of a" << endl ;     cin >> a ;     cout << "Enter the value of b" << endl ;     cin >> b ;     cout << "The value of a is " << a << endl ;     cout << "The value of b is " << b << endl ;     cout << "The value of c is " << a + b << endl ;     cout << " \n " ; //use of sizeof()keyword// use of f and l in float and long double;// //****use of float, double, long double, literals********//     cout << " \n " ;     float x = 10.5 ;     long double y = 90.5 ;     cout << "The size of x is " << sizeof ( 10.5 ) << endl ;     cout << "The size of y is " << sizeof ( 90.5 ) << endl ;     cout << "The size of xl is " << sizeof ( 10.5

INPUT& OUTPUT

  #include <iostream> using namespace std ; int main (){     int num1 ;     int num2 ;     cout << "Enter the value of num1 = \n " ;     cin >> num1 ;     cout << "Enter the value of num2 = \n " ;     cin >> num2 ;     cout << "The total of both num1 & num 2 is = " << num1 + num2 ;     return 0 ; }

HEADER FILES & OPERATORS

  #include <iostream> using namespace std ; int main (){     cout << "This is a hello world program \n " ;     float a = 10 ;     float b = 20 ;     cout << " \n The sum of a+b is :" << a + b ; /*arithmetic operators*/     cout << " \n The sum of a-b is :" << a - b ; /*arithmetic operators*/     cout << " \n The sum of a*b is :" << a * b ; /*arithmetic operators*/     cout << " \n The sum of a/b is :" << a / b ; /*arithmetic operators*/     cout << " \n " ;     //Increment Decrement Operators//     cout << " \n The sum of a++ is :" << a ++; /*increment decrement operators*/     cout << " \n The sum of a++ is :" << a ;   /*increment decrement operators*/     cout << " \n The sum of ++a is :" << ++ a ; /*increment decrement operators*/     cout << " \n The sum of a-- is :" &l

C++ Tutorial Tutorial 1

#include <iostream> using namespace std ; int main (){     int a = 10 ;     int b = 20 ;     float a1 = 100.9 ;     double b1 = 189.90 ;     char name = 'c' ;     bool is_true = true ;     cout << "Hello World \n " << ". This is  the value of integer = \n " << a << ". and this is a value of float= \n " << a1 ;     cout << "The char i stored in name is \n " << name ;     cout << "The value is \n " << is_true ;     bool is_false = false ;     cout << "The bool is \n " << is_false ;     return 0 ; }