Matrix addition

Posted by sameer on Wednesday, June 10, 2009 In : Matrix 
#include<iostream.h
#include<process.h
#include<conio.h
void main()
{
int a[10][10],b[10][10],c[10][10],rowa,cola,rowb,colb,i,j;
cout<<"enter the data for matrix A\n";
cout<<"enter the number of rows=";
cinrowa;
cout<<"enter the number of coloumns=";
cincola;
cout<<"enter the data for matrix B\n";
cout<<"enter the number of rows=";
cinrowb;
cout<<"enter the number of coloumns=";
cincolb;
if((rowa!=rowb)&&(cola!=colb))
{
cout<<"Matrix cannot be added\n";
exit(0);
}
cout<<"Matrix have same order and can be added\n"...

Continue reading...
 

calculator-switch case

Posted by sameer on Monday, June 8, 2009 In : switch case 
//calculator
//switch case
#include<iostream.h
void main()
{
float a,b,c;
int choice;
cout<<"enter the first number=";
cina;
cout<<"enter the second number=";
cinb;
cout<<"enter the operation\n1=addition\n2=substraction\n3=multiplication\n4=division\n";
cinchoice;
switch(choice)
{
case 1:
c=a+b;
cout<<"addition="<<c;
break;

case 2:
c=a-b;
cout<<"substraction="<<c;
break;

case 3:
c=a*b;
cout<<"product="<<c;
break;

case 4:
c=a/b;
cout<<"quotient="<<c;
break;

default:
cout<<"wrong choice";

}
}

explaination:In this program the swi...

Continue reading...
 

fibonacci series-for loop

Posted by sameer on Monday, June 8, 2009 In : for loop 
//Fibonacci series
//program to implement fibonacci series of a number
#include<iostream.h
void main()
{
int n,first=0,second=1,third;
cout<<"enter the number of elements=";
cinn;
cout<<"\n"<<first<<"  ";
cout<<second<<"  ";
for(int i=0;i<n;i++)
{
third=first+second;
cout<<third<<"  ";
first=second;
second=third;
}
}

fibonacci series is a series in which every third number is the sum of the two preceding numbers.In this program e use three numbers first,second,third.first we print the values of the first an...

Continue reading...
 
 

About Me


I AM KUNAL KUMAR SINGH AND IHAVE GREAT PROGRAMMING KNOWLEDGE WHICH I HAVE USED TO DESIGN THIS SITE . KINDY TAKE AS MUCH HELP AND INFO FROM MY SITE AS POSSIBLE .

 

DONATE  ANY AMOUNT FOR C++NOW 

Recent Posts