My Computer Science Project

Only available on StudyMode
  • Topic: Series, Binary numeral system, Summation
  • Pages : 28 (3092 words )
  • Download(s) : 44
  • Published : May 9, 2013
Open Document
Text Preview
Programs on C++

Akshay Kishor Chauhan
XI-Bliss
Roll No. :- Three

Acknowledgment
I would like to express my special thanks of gratitude to my teachers as well as our principal who gave me the golden opportunity to do this wonderful project, which also helped me in doing a lot of Research and I came to know about so many new things. I am really thankful to them.

Secondly I would also like to thank my parents and friends who helped me a lot in finishing this project within the limited time.

I am making this project not only for marks but to also increase my knowledge.

THANKS AGAIN TO ALL WHO HELPED ME.

Content
1. No Of Digits in Number
2. Decimal to Binary & viceversa
3. Sum of Series
4. Binary to Octal & Octal to Binary
5. Reversing each word in a string
6. Sum of Series 2
7. No of Char, Vowels, Space in a string
8. Star Design + Pascals Triangle
9. Bubble Selection Sort
10. Linear & Binary Search
11. Merge Arrays
12. Insert & Delete an element from array
13. Multiplication of 2 matrix
14. Row Column Sum
15. Diagonal Sum

No Of Digits in Number
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x=0,n;
cout<<"Enter the number :";
cin>>n;
while(n>0)
{
n=n/10;
x=x+1;
}
cout<<"The no of digits are :"<<x;
getch();
}

Output:-

Decimal to Binary & viceversa

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a,g,h,s=0,i=0,d,b,ch;
cout<<endl<<"Enter the choice - "<<endl<<"1:Binary to Decimal"<<endl<<"2:Decimal to Binary"<<endl; cin>>ch;
switch(ch)
{
case 1:

cout<<"Enter the Binary Digit"<<endl;
cin>>b;
while(b>0)
{
a=b%10;
s=s+a*(pow(2,i));
i=i+1;
b=b/10;
}
cout<<"Answer ="<<s<<endl;
break;

case 2:
cout<<"Enter the Decimal"<<endl;
cin>>d;
while(d>0)
{
a=d%2;
a=a*pow(10,i);
s=s+a;
i=i+1;
d=d/2;
}
cout<<"Answer ="<<s<<endl;
break;

default:
cout<<"Wrong choice"<<endl;
break;
}
getch();

}

Output:-

Sum of Series

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int j,n,s=0,s1=0,i;
cout<<"Enter the limit :";
cin>>n;
for(i=1;i<=n;i++)
{
for(j=2;j<=2*i;j=j+2)
{
s=s+j*j;
}
s1=s1+s;
s=0;
}
cout<<"Sum of series is :"<<s1;
getch();
}

Output:-

Binary to Octal & Octal to Binary

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int oc,p,r,ch,n,a,i=0,x=0,d=0,j,o;
long int b,s=0,sum=0;
cout<<"Enter Choice"<<endl;
cout<<"1.B-O"<<endl<<"2.O-B"<<endl;
cin>>ch;
switch(ch)
{
case 1:
cout<<"ENTER THE BINARY DIGIT :"<<endl;
cin>>b;
while(b>0)
{
a=b%1000;
j=0;
d=0;
while(a>0)
{
n=(a%10);
d=d+(n*pow(2,j));
j=j+1;
a=a/10;
}
x=x+(d*pow(10,i));
i=i+1;
b=b/1000;
}
cout<<"Answer ="<<x;
break;

case 2:
cout<<"Enter the Octel"<<endl;
cin>>oc;
i=0;
j=0;
sum=0;
s=0;

while(oc>0)
{
p=oc%1000;
while(p>0)
{
r=p%2;
s=s+r*pow(10,j);
j++;
p=p/2;
}
sum=sum+(s*pow(1000,i));
i++;
oc=oc/10;
j=0;
}
cout<<"Binary ="<<sum;
break;

default:
cout<<"????????????????????????"<<endl;
break;
}
getch();
}

Output:-

Reversing each word in a string

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
#include<stdio.h>
void main()
{
clrscr();
int ch,i,j,k=0,p=0,l;
char st[50],sr[50];
cout<<"Enter Your Choice : "<<endl<<"1.Each Word Reversing"<<endl<<"2.Whole Sentence Reversing"<<endl; cin>>ch;
switch(ch)...
tracking img