e6390af40fd246928c9f6b67562cf0fa37712fa8

11/17/2018

Basic Operators used in C++ Programming Language


These are different types of operators used in c++ programming language.
1.       Arithmetic Operators
Operators like +,-,*, / etc. are arithmetic operators.
·         Unary Operators
Operator that work as a single operator is unary like (A++)
·         Binary Operators
Operators that operates or work with two operands like (A*B)
2.       Rational Operators
These are used to compare values or for conditions like (==, >= , <= )
3.       Logical Operators
The operators that are used for logics like (&&, ||, ! )
4.       Bitwise Operators
The Operators that are used for output and outputs (<<,>>,^,~)
5.       Assignment Operators
These operators are used to assign a value. Like ( a=10 )
6.       Misc Operator
The operators used to find size, comma, cast etc. like (Condition ? X : Y)

6/10/2018

Parking Project in C++ Using Structure

In this project there is a Parking Area and they can park maximum 50 vehicles in this area. The vehicles are Car, Bus and Rikshaw. The total amount is counted when the vehicle is enter into to the parking area..The Rikshaw will charged 100 rupees, car will charged 200 rupees and bus will charged 300 rupees.You can also change their values.


#include <iostream>
using namespace std;

struct Parking
{
    int total;
    int riksha;
    int bus;
    int car;

};

void show(struct Parking p1){

cout << "\n\n!!!!!!!!!! Your Recored is Here!!!!!!!!!!!!!\n\n" << endl;
cout << "Total No of Rikshaws : " << p1.riksha<< endl;
cout <<" Total No of Cars : " << p1.car << endl;
cout << "Total No of Buses  :" << p1.bus<<endl;
cout << "Total Income of Today  :" << p1.total<<endl;

  cout << "\n\n!!!!!!!!!! Thanks :) !!!!!!!!!!!!!\n\n" << endl;
}

int main()
{
int count=0;
int r=0,c=0,b=0,t=0;
struct Parking p1;
char exit;
int user;
p1.bus=0;
p1.car=0;
p1.riksha=0;
p1.total=0;


do{

cout<<"Enter 1 for Riksha"<<endl;
cout<<"Enter 2 for Car"<<endl;
cout<<"Enter 3 for Bus"<<endl;
cout<<"Enter 4 for Show Recored"<<endl;
cout<<"Enter 5 for Delete Record"<<endl;

do{
cout<<"\nEnter Your Choice"<<endl;
cin>>user;
if(user==1){
system("Color f2");
cout<<"You Parked Rikshaw and charged 100 Rupees\n"<<endl;
r=r+1;
p1.riksha=r;
t=t+100;
p1.total=t;
count++;
}
else if(user==2){
system("Color d2");
cout<<"You Parked Car and charges 200 Rupees"<<endl;
c=c+1;
p1.car=c;
t=t+200;
p1.total=t;
count++;
}
else if(user==3){
system("Color a4");
cout<<"You Parked Bus and charged 300 Rupees"<<endl;
b=b+1;
p1.bus=b;
t=t+300;
p1.total=t;
count++;
}
else if(user==4){
system("color b4");
show(p1);
}
else if(user==5){
p1.bus=0;
p1.car=0;
p1.riksha=0;
p1.total=0;
cout<<"Record deleted"<<endl;
system("Color c6");
}
else{
cout<<"Wrong Input"<<endl;
}

}while (count<5);//inner do while


cout<<"Press y to continue program and n to close..."<<endl;
cin>>exit;

}while(exit!='n'); ///outer do while

    return 0;
}

10/15/2017

How to use for loop in c++ Programming | For Loop Structure and Examples in c++

In this post we will discus how to use the for loop in c++ programming language.The first thing we discus is that "What is the loop and why we use it?".So the loop is the repetition that is used to repeat the code of c++ language or any  other  language where  the loop is used.For loop is the easiest loop in c++ programming language because here we use the initial point of loop, condition and the increment  in the same brace like ( int a=1; a<=10; a++) here a=1 is the starting point of the loop and a<= is the condition of the loop and a++ is to increment in a..The syntax is given bellow..

Syntax:
#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main

   for( starting point ;  condition ; increment/decrements )
     {
          // body of the for
     }

     system("pause");

}//end of main


The for loop is used a lot in programming.This is also use to print diamond, Triangle, Rectangle, straight, curve and many more shapes in c++ programming. Now here we will discus some shapes.

Example No#1:
Write a c++ program to print the Table of any number from 1 to 10 that is given by the user using for Loop.
Solution:

#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main

    int no;  //this is the number to take table number from the user.
    cout<<" Enter the Table Number "<<endl;
    cin>>no;

   for(int i=1;i<=10;i++)
     {
       cout<<no<< " * "<<i<<" = "<<no*i<<endl; // this line print table
     }
     system("pause");
}//end of main

Example 2 : 
Write a program that take Table number, starting and end point of the table from the user and print table in c++ programming Language.
Solution : 
#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main
           
     int no;  //this is the variable to take table Number from the user.
     int st; //this is the starting point of the loop
     int end;//this is the ending point of the loop
     cout<<" Enter the Table Number "<<endl;
     cin>>no; 
     cout<<" Enter the starting point "<<endl;

     cin>>st; 
     cout<<" Enter the Ending Point "<<endl;

     cin>>end; 
      while(st<=end);//this is condition of loop
     {
      cout<<no<< " * "<<i<<" = "<<no*i<<endl; // this line print table
           
       st++; //this will increment  in start of 1 after every iteration.

     }
     cout<<"\n\n\n"<<endl;
     system("pause");

}//end of main

Example 2 : 
Write a program that take Table number, starting and end point of the table from the use and print table in c++ programming Language.
Solution : 
#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main
           
     int no;  //this is the variable to take table Nimber from the user.
     int st; //this is the starting point of the loop
     int end;//this is the ending point of the loop
     cout<<" Enter the Table Number "<<endl;
     cin>>no; 
     cout<<" Enter the starting point "<<endl;
     cin>>st; 
     cout<<" Enter the Ending Point "<<endl;
     cin>>end; 
      for ( ;st<=end;  st++);//this is condition of loop
     {
      cout<<no<< " * "<<i<<" = "<<no*i<<endl; // this line print table
     }
     system("pause");

}//end of main

Example 3 : 
write a program to print half pyramid in c++ programming Language.
Solution : 
#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main

     int rows;
     cout<<" Enter Number of rows do you want to print "<<endl;
     cin>>rows; // enter the  number of rows do you want to print.
     for(int i=1;i<=rows;i++)
     {
           for(int j=1;j<=i;j++)
           {
                cout<< " * ";
           }
           cout<<endl;
     }

     cout<<"\n\n\n"<<endl;
     system("pause");
}//end of main


Example 4 : 
write a program to print inverted half pyramid in c++ programming Language.
Solution : 
#include<iostream>
using namespace std; // Header files
void  main()
{ //start of main

     int rows;
     cout<<" Enter Number of rows do you want to print "<<endl;
     cin>>rows; // give the  number of rows do you want to print.
     for(int i=rows;i<=1;i--)
     {
           for(int j=1;j<=i;j++)
           {
                cout<< " * ";
           }
           cout<<endl;
     }

     cout<<"\n\n\n"<<endl;
     system("pause");

}//end of main




Example 4 : 
Write a program to print Floyd's Triangle in c++ programming Language.
Solution : 
 #include<iostream>
using namespace std; // Header files
void  main()
{ //start of main
     int Number=1;
     int rows; //veriable decleration
     cout<<" Enter Number of rows do you want to print "<<endl; //message
     cin>>rows; // give the  number of rows do you want to print.
    
     for(int i=1;i<rows;i++) //condition 1
     {
           for(int j=1;j<=i;j++) //condtion 2 that repeat again and again when condition 1 repeat.
           {
                cout<< Number<<"  "; //this line print star.
                ++Number;
           }
           cout<<endl; //move to next line.
     }

     cout<<"\n\n\n"<<endl; //for next line not necessery.
     system("pause");
}//end of main


For More Programs comment your requirement i will create a program.. 



TAGS
for loop, loop, tutorial, loops, guitar, programming, control flow, computer programming (conference subject), tutorials, how, learn, for, programming language (software genre), 3.3, beginners, how to use for loop in matlab, how to use for loop in html, how to use for loop in php, how to use for loop in excel, how to use for loop in javascript, how to use for loop in c++, python (programming language), how to use for loop in laravel, how to use for loop in android studio, 
c (programming language), python (software), guitar lessons, to, lesson, guitar pedals, beats, looper pedal, loop (music), pedal, python 2.7, python 3, how to use for loop in swift, how to use for loop in matlab, how to use for loop in c programming, how to use for loop in python, how to use for loop in vba, how to use for loop in shell script, how to use for loop vba, how to use for loop c++, how to use for loop, how to use for loops in java, how to use for loop, how to use for loop in c++, 
how to use for loop in php, how to use for loop in java, how to use for loop in jquery, how to use for loop in python, how to use for loop in c++ in hindi, how to use for loop in javascript, how to use for loop in python, iteration, looper, c++, basics, processing (programming language), processing.org, computer science (field of study), java (programming language), processing tutorial, processing 3, for loops in processing, for loop in c hindi, looping using for loop using for loop, 


Privacy Policy for Apps

Privacy Policy Muhammad Shahbaz built the Health Physio Association app as a Free app. This SERVICE is provided by Muhammad Shahbaz at no...