Friday, April 24, 2020

Different Data types in C++

Learn about different Data types of C++:


uint
e.g. int a=10;
uFloat
e.g. float b=10.98;
uDouble
e.g. double c=1000.987;
uChar
e.g. char d='A';
uBool
e.g. bool check=true;

Escape Sequence in C++

There are some important Escape sequences in C++ :


u\n    
 e.g.  cout<<" Sof \n tech \n";
 //cout<<"sof"<<'\n'<<"tech"<<'\n'; 
u\t
e.g. cout<<"Sof \t tech \n"; 
//cout<<"sof"<<'\t'<<"tech"<<'\n';
u\’
e.g. cout<<"\' Softech \' "<<'\n';
u\”
e.g. cout<<"\" softech \""<<'\n';

Friday, April 17, 2020

C++ program swapping of two numbers without using 3rd variable

Do you know to swap using 3rd variable ?
If yes then learn who to swap without using 3rd variable


#include<iostream>
using namespace std;
void main()
{
//Swapping without 3rd variable
 int a=10,b=20; //Value of a=10 and b=20
 cout<<"Value of 'a' before Swapping: "<<a<<endl;
 cout<<"Value of 'b' before Swapping: "<<b<<endl;
 a=a+b;     //now a=a(10)+b(20) -> a=30
 b=a-b;     //now b=a(30)-b(20) -> b=10
 a=a-b;     //now a=a(30)-b(10) -> a=20
 cout<<"Value of 'a' after swapping: "<<a<<endl;
 cout<<"Value of 'b' after swapping: "<<b<<endl;
system("pause");
}
Link of Video for more help::
https://youtu.be/9PYADBSffQ0


C++ program swapping of two variables using 3rd variable

DO you want to swap Number ?
Then lets do it.....


#include<iostream>
using namespace std;
void main()
{
//Swapping with 3rd Variable
    int a=10,b=20,c;
   cout<<"Value of 'a' before Swapping: "<<a<<endl;
   cout<<"Value of 'b' before Swapping: "<<b<<endl;
c=a; //c=a(10) -> c=10
a=b; //a=b(20) -> a=20
b=c; //b=c(10) -> b=10
   cout<<"Value of 'a' after swapping: "<<a<<endl;
   cout<<"Value of 'b' after swapping: "<<b<<endl;

system("pause");
}

Video Link for more Help::
https://youtu.be/9PYADBSffQ0



Sunday, April 12, 2020

How to use cout and cin statement Program:

Program C++


#include<iostream>
using namespace std;
void main()
{
 cout<<"Enter favorite No"<<endl;
int n;
cin>>n;
cout<<n<<endl;
system("pause");
}
Click on the link below

video related to this code 
https://youtu.be/-TLumzNgcjs



Cin & cout


Do you know How to Display something on a screen (Console) like a message OR variable name?







Learn about cin statement 



´Syntax :  cout<<“message”<<endl;
OR
´ Syntax : cout<<variable name<<endl;
´
´Cin>>variable name;

Delimiters & braces:

What is Delimiters?



What are braces?




Do worry you will learn about it

´“ ; ” is known as delimiter
´It is written at the end of every statement
´
´“ { “ opening braces
´  } ” closing braces
system("pause") command is used to stop your console screen and when you press any key then console gone.
Syntax:
system(“pause”);

C++ libraries

How to add C++ libraries?
Do you wanna know that .....


´include keyword
´Begin with # symbol
´There are many built in libraries
´E.g.
´#include <iostream> //method one
´#include <cstring>
´#include ”fstream”  //Second Method

Basic Structure of C++


This is the basic structure of C++ program

#include<iostream>
using namespace std;
void main()
{
system("pause");
}

Maximum No

//Find the Maximum No between Three Nos' int i=10,o=20,k=30; if(i>o &&i>k) { cout<<"1st is g\n";...