===========================================================================
CODING
#include<all.h>
void main()
{
label:
clrscr();
float a,b,R,n,c,n1;
char Re,q,n2,flag='t';
gotoxy(36,1);
cprintf("CALCULATOR");
gotoxy(1,2);
cprintf("--------------------------------------------------------------------------------");
gotoxy(32,4);
cprintf("Functions Available:");
gotoxy(1,5);
cprintf("--------------------------------------------------------------------------------");
gotoxy(20,7);
cprintf("¯ +[1]");
gotoxy(20,9);
cprintf("¯ -[2]");
gotoxy(20,11);
cprintf("¯ /[3]");
gotoxy(50,7);
cprintf("¯ *[4]");
gotoxy(50,9);
cprintf("¯ %[5]");
gotoxy(50,11);
cprintf("¯ Power[6]");
gotoxy(35,13);
cprintf("¯ Sqrt[7]");
gotoxy(1,15);
cprintf("--------------------------------------------------------------------------------");
gotoxy(2,18);
cprintf(" Enter the Function you want to perform: ");
cin>>n;
if(n==1)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a+b;
}
else if(n==2)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a-b;
}
else if(n==3)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
if(b==0)
{
flag='f';
R=0;
}
else
R=a/b;
}
else if(n==4)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a*b;
}
else if(n==5)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Number: ");
cin>>a;
R=a/100;
}
else if(n==6)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Base No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter Power No.: ");
cin>>b;
R=pow(a,b);
}
else if(n==7)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>a;
if(a<0)
{
flag='f';
R=0;
}
else
R=sqrt(a);
}
else
{
clrscr();
gotoxy(2,3);
cprintf("Wrong Input!");
gotoxy(2,5);
cprintf("TRY Again? Y-yes N-no :");
cin>>q;
if(q=='Y' || q=='y')
goto label;
else
exit(0);
}
clrscr();
gotoxy(36,2);
printf("CALCULATOR");
gotoxy(1,3);
cprintf("--------------------------------------------------------------------------------");
gotoxy(31,5);
printf("████████████████████");
gotoxy(31,6);
printf("█ █");
gotoxy(31,7);
if(flag=='t')
{
if(R>=0 && R<=9.99999)
printf("█ %.1f █",R);
else if(R>=10 && R<=99.99999)
printf("█ %.1f █",R);
else if(R>=100 && R<=999.99999)
printf("█ %.1f █",R);
else if(R>=1000 && R<=9999.99999)
printf("█ %.1f █",R);
else if(R<0 && R>=-9.99999)
printf("█ %.1f █",R);
else if(R<=-10 && R>=-99.99999)
printf("█ %.1f █",R);
else if(R<=-100 && R>=-999.99999)
printf("█ %.1f █",R);
else
printf("█ %.1f █",R);
}
else if(flag=='f')
{
printf("█ -ERROR- █");
}
gotoxy(31,8);
printf("████████████████████");
gotoxy(31,9);
printf("█ sqrt █ pow ██ = ██");
gotoxy(31,10);
printf("████████████████████");
gotoxy(31,11);
printf("█ 7 █ 8 █ 9 █ - █");
gotoxy(31,12);
printf("████████████████████");
gotoxy(31,13);
printf("█ 4 █ 5 █ 6 █ / █");
gotoxy(31,14);
printf("████████████████████");
gotoxy(31,15);
printf("█ 1 █ 2 █ 3 █ * █");
gotoxy(31,16);
printf("████████████████████");
gotoxy(31,17);
printf("█ . █ 0 █ % █ + █");
gotoxy(31,18);
printf("████████████████████");
gotoxy(1,20);
cprintf("--------------------------------------------------------------------------------");
gotoxy(1,22);
cprintf(" Should the Result be Saved and perform another function with it (Y-yes N-no): ");
cin>>Re;
if(Re=='Y' || Re=='y')
{
label1:
clrscr();
gotoxy(36,1);
cprintf("CALCULATOR");
gotoxy(1,2);
cprintf("--------------------------------------------------------------------------------");
gotoxy(32,4);
cprintf("Functions Available:");
gotoxy(1,5);
cprintf("--------------------------------------------------------------------------------");
gotoxy(20,7);
cprintf("¯ +[1]");
gotoxy(20,9);
cprintf("¯ -[2]");
gotoxy(20,11);
cprintf("¯ /[3]");
gotoxy(50,7);
cprintf("¯ *[4]");
gotoxy(50,9);
cprintf("¯ %[5]");
gotoxy(50,11);
cprintf("¯ Power[6]");
gotoxy(35,13);
cprintf("¯ Sqrt[7]");
gotoxy(1,15);
cprintf("--------------------------------------------------------------------------------");
gotoxy(2,18);
cprintf("Enter the Function you want to perform: ");
cin>>n1;
if(n1==1)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=c+R;
}
else if(n1==2)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=R-c;
}
else if(n1==3)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
if(c==0)
{
flag='f';
R=0;
}
else
R=R/c;
}
else if(n1==4)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=c*R;
}
else if(n1==5)
{
R=R/100;
}
else if(n1==6)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Power No.: ");
cin>>c;
R=pow(R,c);
}
else if(n1==7)
{
if(R<0)
{
flag='f';
R=0;
}
else
R=sqrt(R);
}
else
{
clrscr();
gotoxy(2,3);
cprintf("Wrong Input!");
gotoxy(2,5);
cprintf("TRY Again? Y-yes N-no :");
cin>>q;
if(q=='Y' || q=='y')
goto label1;
else
exit(0);
}
clrscr();
gotoxy(31,2);
printf(" CALCULATOR ");
gotoxy(1,3);
cprintf("--------------------------------------------------------------------------------");
gotoxy(31,5);
printf("████████████████████");
gotoxy(31,6);
printf("█ █");
gotoxy(31,7);
if(R>=0 && R<=9)
printf("█ %.1f █",R);
else if(R>=10 && R<=99.99999)
printf("█ %.1f █",R);
else if(R>=100 && R<=999.99999)
printf("█ %.1f █",R);
else if(R>=1000 && R<=9999.999999)
printf("█ %.1f █",R);
else if(R<0 && R>=-9.99999)
printf("█ %.1f █",R);
else if(R<=-10 && R>=-99.99999)
printf("█ %.1f █",R);
else if(R<=-100 && R>=-999.99999)
printf("█ %.1f █",R);
else
printf("█ %.1f █",R);
gotoxy(31,8);
printf("████████████████████");
gotoxy(31,9);
printf("█ sqrt █ pow ██ = ██");
gotoxy(31,10);
printf("████████████████████");
gotoxy(31,11);
printf("█ 7 █ 8 █ 9 █ - █");
gotoxy(31,12);
printf("████████████████████");
gotoxy(31,13);
printf("█ 4 █ 5 █ 6 █ / █");
gotoxy(31,14);
printf("████████████████████");
gotoxy(31,15);
printf("█ 1 █ 2 █ 3 █ * █");
gotoxy(31,16);
printf("████████████████████");
gotoxy(31,17);
printf("█ . █ 0 █ % █ + █");
gotoxy(31,18);
printf("████████████████████");
gotoxy(1,20);
cprintf("--------------------------------------------------------------------------------");
gotoxy(1,22);
cprintf(" Should the Result be Saved and perform another function with it (Y-yes N-no): ");
cin>>Re;
if(Re=='Y' || Re=='y')
goto label1;
else
{
gotoxy(1,23);
cprintf(" Do you wish to Start a fresh function (Y-yes N-no): ");
cin>>n2;
if(n2=='Y' || n2=='y')
goto label;
else
exit(0);
}
}
else
{
gotoxy(1,23);
cprintf(" Do you wish to Start a fresh function (Y-yes N-no): ");
cin>>n2;
if(n2=='Y' || n2=='y')
goto label;
else
exit(0);
}
getch();
}
CODING
#include<all.h>
void main()
{
label:
clrscr();
float a,b,R,n,c,n1;
char Re,q,n2,flag='t';
gotoxy(36,1);
cprintf("CALCULATOR");
gotoxy(1,2);
cprintf("--------------------------------------------------------------------------------");
gotoxy(32,4);
cprintf("Functions Available:");
gotoxy(1,5);
cprintf("--------------------------------------------------------------------------------");
gotoxy(20,7);
cprintf("¯ +[1]");
gotoxy(20,9);
cprintf("¯ -[2]");
gotoxy(20,11);
cprintf("¯ /[3]");
gotoxy(50,7);
cprintf("¯ *[4]");
gotoxy(50,9);
cprintf("¯ %[5]");
gotoxy(50,11);
cprintf("¯ Power[6]");
gotoxy(35,13);
cprintf("¯ Sqrt[7]");
gotoxy(1,15);
cprintf("--------------------------------------------------------------------------------");
gotoxy(2,18);
cprintf(" Enter the Function you want to perform: ");
cin>>n;
if(n==1)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a+b;
}
else if(n==2)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a-b;
}
else if(n==3)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
if(b==0)
{
flag='f';
R=0;
}
else
R=a/b;
}
else if(n==4)
{
clrscr();
gotoxy(2,3);
cprintf("Enter 1st No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter 2nd No.: ");
cin>>b;
R=a*b;
}
else if(n==5)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Number: ");
cin>>a;
R=a/100;
}
else if(n==6)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Base No.: ");
cin>>a;
gotoxy(2,5);
cprintf("Enter Power No.: ");
cin>>b;
R=pow(a,b);
}
else if(n==7)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>a;
if(a<0)
{
flag='f';
R=0;
}
else
R=sqrt(a);
}
else
{
clrscr();
gotoxy(2,3);
cprintf("Wrong Input!");
gotoxy(2,5);
cprintf("TRY Again? Y-yes N-no :");
cin>>q;
if(q=='Y' || q=='y')
goto label;
else
exit(0);
}
clrscr();
gotoxy(36,2);
printf("CALCULATOR");
gotoxy(1,3);
cprintf("--------------------------------------------------------------------------------");
gotoxy(31,5);
printf("████████████████████");
gotoxy(31,6);
printf("█ █");
gotoxy(31,7);
if(flag=='t')
{
if(R>=0 && R<=9.99999)
printf("█ %.1f █",R);
else if(R>=10 && R<=99.99999)
printf("█ %.1f █",R);
else if(R>=100 && R<=999.99999)
printf("█ %.1f █",R);
else if(R>=1000 && R<=9999.99999)
printf("█ %.1f █",R);
else if(R<0 && R>=-9.99999)
printf("█ %.1f █",R);
else if(R<=-10 && R>=-99.99999)
printf("█ %.1f █",R);
else if(R<=-100 && R>=-999.99999)
printf("█ %.1f █",R);
else
printf("█ %.1f █",R);
}
else if(flag=='f')
{
printf("█ -ERROR- █");
}
gotoxy(31,8);
printf("████████████████████");
gotoxy(31,9);
printf("█ sqrt █ pow ██ = ██");
gotoxy(31,10);
printf("████████████████████");
gotoxy(31,11);
printf("█ 7 █ 8 █ 9 █ - █");
gotoxy(31,12);
printf("████████████████████");
gotoxy(31,13);
printf("█ 4 █ 5 █ 6 █ / █");
gotoxy(31,14);
printf("████████████████████");
gotoxy(31,15);
printf("█ 1 █ 2 █ 3 █ * █");
gotoxy(31,16);
printf("████████████████████");
gotoxy(31,17);
printf("█ . █ 0 █ % █ + █");
gotoxy(31,18);
printf("████████████████████");
gotoxy(1,20);
cprintf("--------------------------------------------------------------------------------");
gotoxy(1,22);
cprintf(" Should the Result be Saved and perform another function with it (Y-yes N-no): ");
cin>>Re;
if(Re=='Y' || Re=='y')
{
label1:
clrscr();
gotoxy(36,1);
cprintf("CALCULATOR");
gotoxy(1,2);
cprintf("--------------------------------------------------------------------------------");
gotoxy(32,4);
cprintf("Functions Available:");
gotoxy(1,5);
cprintf("--------------------------------------------------------------------------------");
gotoxy(20,7);
cprintf("¯ +[1]");
gotoxy(20,9);
cprintf("¯ -[2]");
gotoxy(20,11);
cprintf("¯ /[3]");
gotoxy(50,7);
cprintf("¯ *[4]");
gotoxy(50,9);
cprintf("¯ %[5]");
gotoxy(50,11);
cprintf("¯ Power[6]");
gotoxy(35,13);
cprintf("¯ Sqrt[7]");
gotoxy(1,15);
cprintf("--------------------------------------------------------------------------------");
gotoxy(2,18);
cprintf("Enter the Function you want to perform: ");
cin>>n1;
if(n1==1)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=c+R;
}
else if(n1==2)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=R-c;
}
else if(n1==3)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
if(c==0)
{
flag='f';
R=0;
}
else
R=R/c;
}
else if(n1==4)
{
clrscr();
gotoxy(2,3);
cprintf("Enter No.: ");
cin>>c;
R=c*R;
}
else if(n1==5)
{
R=R/100;
}
else if(n1==6)
{
clrscr();
gotoxy(2,3);
cprintf("Enter Power No.: ");
cin>>c;
R=pow(R,c);
}
else if(n1==7)
{
if(R<0)
{
flag='f';
R=0;
}
else
R=sqrt(R);
}
else
{
clrscr();
gotoxy(2,3);
cprintf("Wrong Input!");
gotoxy(2,5);
cprintf("TRY Again? Y-yes N-no :");
cin>>q;
if(q=='Y' || q=='y')
goto label1;
else
exit(0);
}
clrscr();
gotoxy(31,2);
printf(" CALCULATOR ");
gotoxy(1,3);
cprintf("--------------------------------------------------------------------------------");
gotoxy(31,5);
printf("████████████████████");
gotoxy(31,6);
printf("█ █");
gotoxy(31,7);
if(R>=0 && R<=9)
printf("█ %.1f █",R);
else if(R>=10 && R<=99.99999)
printf("█ %.1f █",R);
else if(R>=100 && R<=999.99999)
printf("█ %.1f █",R);
else if(R>=1000 && R<=9999.999999)
printf("█ %.1f █",R);
else if(R<0 && R>=-9.99999)
printf("█ %.1f █",R);
else if(R<=-10 && R>=-99.99999)
printf("█ %.1f █",R);
else if(R<=-100 && R>=-999.99999)
printf("█ %.1f █",R);
else
printf("█ %.1f █",R);
gotoxy(31,8);
printf("████████████████████");
gotoxy(31,9);
printf("█ sqrt █ pow ██ = ██");
gotoxy(31,10);
printf("████████████████████");
gotoxy(31,11);
printf("█ 7 █ 8 █ 9 █ - █");
gotoxy(31,12);
printf("████████████████████");
gotoxy(31,13);
printf("█ 4 █ 5 █ 6 █ / █");
gotoxy(31,14);
printf("████████████████████");
gotoxy(31,15);
printf("█ 1 █ 2 █ 3 █ * █");
gotoxy(31,16);
printf("████████████████████");
gotoxy(31,17);
printf("█ . █ 0 █ % █ + █");
gotoxy(31,18);
printf("████████████████████");
gotoxy(1,20);
cprintf("--------------------------------------------------------------------------------");
gotoxy(1,22);
cprintf(" Should the Result be Saved and perform another function with it (Y-yes N-no): ");
cin>>Re;
if(Re=='Y' || Re=='y')
goto label1;
else
{
gotoxy(1,23);
cprintf(" Do you wish to Start a fresh function (Y-yes N-no): ");
cin>>n2;
if(n2=='Y' || n2=='y')
goto label;
else
exit(0);
}
}
else
{
gotoxy(1,23);
cprintf(" Do you wish to Start a fresh function (Y-yes N-no): ");
cin>>n2;
if(n2=='Y' || n2=='y')
goto label;
else
exit(0);
}
getch();
}
===========================================================================
No comments:
Post a Comment