C Plus Plus Programming

You can learn all c++ programming in this website easilly.

Responsive Ads Here

Adds

Monday, January 21, 2019

how we find vowel words



Programme:

#include<iostream>
using namespace std;
int main()
{
char ch;
cout<<"Enter an alphabet=";
cin>>ch;
{
if(ch=='A'||ch=='a'||ch=='E'||ch=='e'||ch=='I'||ch=='i'||ch=='O'||ch=='o'||ch=='U'||ch=='u')
cout<<ch<<":is a vowel";
else
cout<<ch<<":is not a vowel";
}
}

how to find even odd numbers

Programe

#include <iostream>
using namespace std;
int main()
{
int n ;
cout<<"Enter A Number=";
cin>>n;
{
if(n%2==0)
cout<<n<<":IS Even Number";
else
cout<<n<<":IS odd Number";


}
}

how to creat Cricket Team Management System

Programe

#include<iostream>
#include<conio.h>
#include<string>
#include<iomanip>
using namespace std;
struct cricketer
{
char name[15];
int runs;
int innings;
int tno;
float avg;
};
int main()
{
int runs,innings,i;
float avg;
cricketer rec[5];
cout<<"\nEnter 5 records including following details\n";
cout<<"1)      Player's Name\n";
cout<<"2)       Runs";
cout<<"3)       Innings";
cout<<"4)       Times Not Out";
for(i=0;i<5;i++)
{
cout<<"\nEnter Player Name:-";
cin>>rec[i].name;
cout<<"Enter Runs:-";
cin>>rec[i].runs;
cout<<"Enter Innings:-";
cin>>rec[i].innings;
cout<<"Enter Time Not Out:-";
cin>>rec[i].tno;
rec[i].avg=float(rec[i].runs)/rec[i].innings;
{
cout<<"n\n\n";
cout<<setw(49)<<"CRICKETR'S TABLE\n";
cout<<setw(15)<<"PLAYER'S NAME"<<setw(15)<<"RUNS"<<setw(15)<<"INNINGS";
cout<<setw(20)<<"Times not Out"<<setw(12)<<"Average\n";
for(i=0;i<5;i++)
{
cout<<setw(15)<<rec[i].name<<setw(15)<<rec[i].runs<<setw(12)<<rec[i].innings;
cout<<setw(18)<<rec[i].tno<<setw(16)<<rec[i].avg<<endl;
{
cout<<endl<<endl<<endl;
cout<<setw(43)<<"Finish\n";
getch();
 
}
}
}
}
}

speed calculator



Programme


#include <iostream>
using namespace std;
int main()
{
double distance,speed,time;
cout<<"Enter distance in kilometer:";
cin>>distance;
cout<<"Enter speed of your vehicle (Mph):";
cin>>speed;
{
time=distance/speed;
cout<<"Time required To Reach  Distance (in hours) ="<<time<<endl;
}

}

creat age calculator


Programme:


#include<iostream>
using namespace std;
int main()
{
int n,age;
cout<<"Enter Your Age:";
cin>>n;
switch(n)
{
case 1 ...10:
cout<<"Kid";
break;
case 11 ...15:
cout<<"childhood";
break;
case 16 ...20:
cout<<"Young";
break;
case 21 ...30:
cout<<"Mature";
break;
case 31 ...50:
cout<<"old man";
break;
default:
cout<< "You are Older Man";
break;
{
cout<<"........................."<<endl;
cout<<"Software Doveloper";
cout<<"Lala Munir";
}
}
}

How we creat a calculator


Programme:



#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a,b,result;
char option,n;
do
{
cout<<"What Opration you to do want"<<endl;
cout<<"+.Addition"<<endl;
cout<<"-.Subtraction"<<endl;
cout<<"*.Multiply"<<endl;
cout<<"/.Devide"<<endl;
cin>>n;
cout<<"Enter First Number:";
cin>>a;
cout<<"Enter Second Number:";
cin>>b;
switch(n)
{
case '+':
result=a+b;
cout<<"Addition Of Two Number is="<<result<<endl;
break;
case '-':
result=a-b;
cout<<"Subtraction Of two number is="<<result<<endl;
break;
case '*':
result=a*b;
cout<<"Multiuplication Of Two Number is="<<result<<endl;
break;
case '/':
result=a/b;
cout<<"Division Of Two Number is="<<result<<endl;
break;
default:
cout<<"Invalid Number"<<endl;
}
cout<<"Do You Want To continue Press Y?"<<endl;
option=getch();
}
while(option=='y');
getch();
return 0;

}


How to creat array in c++


Arrays
An Array is a group of consecutive memory location with same name and type. Simple variable is a single memory location with a unique name and type.But an array is a collection of different adjacant memory location. All these memory locations have one collective name and type.The Memory locations in the array is called length.
Each element in the array is accessed with reference to its position of location in the array.This position is called index or subscript.Each element in the array has a unique index.The index of first element is 0 and the index of last element is length -1. The value of the index is written in brackets along with the name of array

Example:

int marks[5]={40,55,63,17,22,68,89,97,89};


Array are used to store a large amount of simmilar kind of data.Suppose the user wants to store the marks of 100 students and declares 100 variables. it is time consuming proccess to use these varriabless individually. This proccess can be samplified by using array. 

Programme 

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int arr[5];
cout<<"Enter Five Integers:"<<endl;
cin>>arr[0];
cin>>arr[1];
cin>>arr[2];
cin>>arr[3];
cin>>arr[4];
cin>>arr[5];
cout<<"The values in array are:"<<endl;
cout<<arr[0]<<endl;
cout<<arr[1]<<endl;
cout<<arr[2]<<endl;
cout<<arr[3]<<endl;
cout<<arr[4]<<endl;
cout<<arr[5]<<endl;
getch();
}

Using For Loop


#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int arr[5],i;
for(i=0;i<5;i++)
{
cout<<"Enter an integer:";
cin>>arr[i];
}
cout<<"The Values in Array are:<<endl;
for(i=0;i<5;i++)
cout<<arr[i]<<endl;
getch();
}