Thursday, December 10, 2009

C++-->STORE NAMES OF N STUDENTS INTO AN ARRAY

Store names of n students into an array and then search for a particular name #include #include #include #include void main() { int i,n,big; int flag; char name[100][25]; char t[25]; cout<<”Enter how many elements : “; cin>>n; for(i=0;in;i++) ...

Tuesday, December 8, 2009

C++->BIGGEST NUMBER

Write a program to store n numbers into an array and find the biggest number along with its position #include #include void main() { int ar[100],i,n,big; cout<<”Enter how many elements : “; cin>>n; cout<<”Enter the elements \n”; for(i=0;in;i++) cin>>ar[i]; ...

Monday, December 7, 2009

C++->PRIME NUMBERS

Find the prime numbers between 1 and 100 #include #include #include void main() { int i,j,n,p; clrscr(); int flag; for(i=1;i<=100;i++) { p=i; flag=1; for(j=2;j<=p/2;j++) if((p%j)= = 0) { ...

Sunday, December 6, 2009

C++->SERIES FOR n ROWS

Write a program to print the following series for n rows. a a b a b c a b c d . . . nth row. . . #include #include void main() { int i,j,l,n; char ch; clrscr(); ...

Saturday, December 5, 2009

C++->SUM DIFFERENCE PRODUCT AND QUOTIENT

Write a program to find the sum, difference, product and quotient of two numbers using C++ #include #include #include void main() { char ch; float a,b,r; clrscr(); cout<<”\n1. Sum”; cout<<”\n2. Difference”; cout<<”\n3. Product”; cout<<”\n4. Quotient”; cout<<”\n\nEnter your choice……”; ch=getchar(); switch(ch) { case ‘1’: cout<<”Enter two numbers : “; cin>>a>>b; r=a+b; cout<<”Sum : “<>a>>b; r=a-b; cout<<”Difference...

Friday, December 4, 2009

C++->Capital letter, Small letter, a Digit or a Special character.

Input a character and check whether it is a Capital letter, Small letter, a Digit or a Special character.#includevoid main() { char ch; ch=getchar(); if(ch >= ’A’ && ch <= ’Z’) cout<<”Capital letter”; else if(ch >= ’a’ && ch <= ’z’) ...

Followers