PHC-KILATIS12
Eternal Poster
- Joined
- Apr 4, 2017
- Posts
- 705
- Reaction
- 432
- Points
- 314
- Age
- 29
So yun na nga guys gumagawa ako ng program ngayon since na figure out ko na kung pano yung user mismo ang magdedecide kung ilang numbers yung gusto nyang i add/subtract etc..
pero nung ni run ko na yung program sobrang laki nung numbers na ina output nya which is hindi naman dapat kase sa separate program na ginawa ko gumagana naman ng maayos yung program na ginawa ko .
so eto yung program ko na may error ( outputs large numbers )
and then eto naman yung separate program na ginawa ko nung una at gumagana naman ng maayos kaya nababaliw na ko kakaisip kung anong problema dun sa unang program na binigay ko kase same lang talaga sila pramis HAHAHAH .
so yun lang guys sa mga critical thinker dito pa help naman salamuch <3
pero nung ni run ko na yung program sobrang laki nung numbers na ina output nya which is hindi naman dapat kase sa separate program na ginawa ko gumagana naman ng maayos yung program na ginawa ko .
so eto yung program ko na may error ( outputs large numbers )
C++:
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
void gotoxy(short x,short y);
int addition();
int subtraction();
int multiplication();
int division();
int percentage();
int square();
int choice;
int main(){
start :
cout<<"\t\t\t\t\t\t CALCULATOR"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| 1. ADD 3. MULTIPLY |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| 2. SUB 4. DIVIDE |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| 5. PERCENT 6. SQUARE |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t|_____________________________________________________________________________|"<<endl;
gotoxy(37,12);
cout<<"SELECT ( invalid will exit ):";
cin>>choice;
system("cls");
switch(choice)
{
case 1 :
system("cls");
addition();
getch();
break;
case 2 :
system("cls");
subtraction();
getch();
break;
case 3 :
system("cls");
multiplication();
getch();
break;
case 4 :
system("cls");
division();
getch();
break;
case 5 :
system("cls");
percentage();
getch();
break;
case 6 :
system("cls");
square();
getch();
break;
default :
return 0;
}
}
int addition()
{
int b=0;
int a[10];
long sum;
cout<<"\t\t\t\t\t\t CALCULATOR"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
gotoxy(26,5);
cout << " Enter how many numbers you want to add ( 10 is max ) : " ;
cin >> b ;
system("cls");
cout<<"\t\t\t\t\t\t CALCULATOR"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
for(int i=0;i<b;i++)
{
gotoxy(32,3+i);
cout << " Enter number :" ; cin >> a[i];
gotoxy(32,13);
sum = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9];
cout << " SUM :" << sum ;
}
}
int subtraction()
{
int b=0;
int a[10];
int sum;
cout<<"\t\t\t\t\t\t CALCULATOR"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
gotoxy(26,5);
cout << " Enter how many numbers you want to add ( 10 is max ) : " ;
cin >> b ;
system("cls");
cout<<"\t\t\t\t\t\t CALCULATOR"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t| |"<<endl;
cout<<"\t\t_______________________________________________________________________________"<<endl;
for(int i=0;i<b;i++)
{
gotoxy(32,3+i);
cout << " Enter number :" ; cin >> a[i];
gotoxy(32,13);
sum = a[0]-a[1]-a[2]-a[3]-a[4]-a[5]-a[6]-a[7]-a[8]-a[9];
cout << " difference :" << sum ;
}
}
int multiplication()
{
}
int division()
{
}
int percentage()
{
}
int square()
{
}
void gotoxy(short x ,short y)
{
COORD pos={x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
and then eto naman yung separate program na ginawa ko nung una at gumagana naman ng maayos kaya nababaliw na ko kakaisip kung anong problema dun sa unang program na binigay ko kase same lang talaga sila pramis HAHAHAH .
C++:
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
int b=0;
int a[10];
int sum;
void gotoxy(short x,short y);
int main()
{
cout << " Enter how many numbers you want to add ( 10 is max ) : " ;
cin >> b ;
for(int i=0;i<b;i++)
{
cout << " Addition " << endl;
gotoxy(32,3+i);
cout << " Enter number :" ; cin >> a[i];
gotoxy(32,14);
sum = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9];
cout << " SUM :" << sum ;
}
}
void gotoxy(short x ,short y)
{
COORD pos={x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
so yun lang guys sa mga critical thinker dito pa help naman salamuch <3