Skip to content

Commit

Permalink
c projects
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitsurana committed Sep 30, 2019
1 parent d7c12bd commit 033fc81
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ascii of A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <iostream>

using namespace std;

int main()
{
char ch;
int num=ch;
cout << "The ASCII code for" << ch<<"is"<<num<<"\n"<<"\n";
cout << "Adding 1 to the character code" <<"\n"<<"\n";
ch=ch+1;
num=ch;
cout << "The ASCII code for" << ch<<"is"<<num<<"\n"<<"\n";
cout << "Adding 1 to the character code" <<"\n"<<"\n";
ch=ch+1;
num=ch;
cout << "The ASCII code for" << ch<<"is"<<num<<"\n"<<"\n";
return 0;
}
40 changes: 40 additions & 0 deletions distance conversion using function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <iostream>
#include<stdlib.h>
using namespace std;
void convert(float&d,char&t,char ch)
{
switch(ch)
{
case 'F':if(t=='I')
{
d=d/12;
t='I';
}
break;
case 'I':if(t=='F')
{
d=d*12;
t='F';
}
break;
}
}
int main()
{
float d;
char choice,type='F';
cout << "Enter distance in feet:" ;
cin>>d;
cout << "\n Want to convert in feet or inches(F/I):" ;
cout << "Enter your choice:" ;
cin>>choice;
switch(choice)
{
case 'F':convert(d,type,'F');
break;
case 'I':convert(d,type,'I');
break;
}
cout<<"Distance="<<d<<""<<type<<"\n";
return 0;
}
15 changes: 15 additions & 0 deletions even no.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
#include<math.h>
using namespace std;

int main()
{int num,rem;
cout << "Enter a number:" ;
cin>>num;
rem=num%2;
if(rem==0)
cout<<"It is a even number.";
else
cout<<"It is a odd number.";
return 0;
}
18 changes: 18 additions & 0 deletions factorial.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
#include<math.h>
#include<conio.h>
using namespace std;

int main()
{
int i,num,fact=1;
cout << "Enter a number:";
cin>>num;
i=num;
while(num)
{fact*=num;
--num;
}
cout<<"\n"<<"Factorial of"<<i<<"is:"<<fact;
getch();
}
70 changes: 70 additions & 0 deletions rectangular operator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <process.h>
using namespace std;

int main()
{
char ch,ch1;
float a,area,peri,l,b,diagonal;
cout << "Mathematical Operator World:" <<"\n";
cout << "1.Area" <<"\n";
cout << "2.Perimeter" <<"\n";
cout << "3.Diagonal" <<"\n";
cout << "4.Other Information" <<"\n";
cout << "5.About Us" <<"\n";
cout << "6.Exit" <<"\n";

cout << "\n Enter Your Choice:";
do
{
cin>>ch;
if(ch=='1'||ch=='2'||ch=='3')
{cout<<"\nEnter the length of rectangle:";
cin>>l;
cout<<"Enter the breadth of rectangle:";
cin>>b;}
switch(ch)
{
case'1':area=l*b;
cout<<"Area Is : "<<area<<"\n";
break;
case'2':peri=2*(l+b);
cout<<"Perimeter Is : "<<peri<<"\n";
break;
case'3':diagonal=sqrt((l*l)+(b*b));
cout<<"Diagonal Is : "<<diagonal<<"\n";
break;
case'4':cout<<"\n1.Rectangle has four sides."<<"\n";
cout<<"\n2.Rectangle has equal diagonals."<<"\n";
cout<<"\n3.Rectangle has four angles each equal to 90."<<"\n";
cout<<"\n4.Area of Rectangle is = length*breadth."<<"\n";
cout<<"\n5.Perimeter of Rectangle is = 2*(length+breadth)."<<"\n";
cout<<"\n6.Diagonal of Rectangle is = squareroot of [(length)^2 + (breadth)^2]."<<"\n";
break;
case'5':cout<<"\n About Us: "<<"\n";
cout<<"\n Rectangle Operator World "<<"\n";
cout<<" Version 1.09 "<<"\n";
cout<<"\n Harshit Surana"<<"\n";
cout<<" Eatta Soft Pvt.Ltd. "<<"\n";
cout<<"\n THANKS "<<"\n";
break;

case '6': cout<<"\n Exiting.........";
cout<<" Press any key (Recommended-h) to exit"<<"\n";
exit(0);
default :cout<<"Wrong Choice"<<"\n";
cout<<"Enter a valid one."<<"\n";
break;
}
cout<<"\n Want to enter more(Y/N)?:";
cin>>ch1;
if(ch1=='y'||ch1=='Y')
cout<<"Again enter your choice : (1-6):";
}
while(ch1=='y'||ch1=='Y');


return 0;
}

0 comments on commit 033fc81

Please sign in to comment.