using for loops in class

hi guys
i wrote these code,it gets 2 numbers and calculate with class
and im gonna have more numbers not just 2 numbers,where should i write for loop?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;

class Calc{
	private:
		int Number1;
		int Number2;
	public:
		int	GetNumber1(){return Number1;}
		void	SetNumber1(int NewNum){Number1=NewNum;}
		int 	GetNumber2(){return Number2;}
		void	SetNumber2(int NewNum){Number2=NewNum;}
		Calc(int Num1,int Num2){Number1=Num1;Number2=Num2; }
		Calc(){};
		int Sum();
		int Mul();
		int Min();
		float MyDiv();

};

	    Calc *objCalc=new Calc();

void Input();

int  main  (){
    system("cls");


    char ch;

    while(1){
     cout<<"\n\t\t1:input 2:Sum 3:Mul 4:Min  5=Div 6:exit " ;
     cout<<"\n\t\t=";
     cin>>ch;
     system("cls");
     switch(ch){
	case '6':exit(0);
		break;
	case '2':{int s=  objCalc->Sum();
		  cout<<"\nSum="<<s<<endl;
	} 	break;
	case '1':Input();
		break;
	case '3':cout<<"\nMul="<<objCalc->Mul();
		break;
	case '4':cout<<"\nMin="<<objCalc->Min();
		break;
	case '5':cout<<"\nDiv="<<objCalc->MyDiv();
		break;

     }
    }

  getch();
 return 0;
}
int Calc::Sum(){
   return (Number1+Number2);
}

void Input(){
   int TempNumber;
  cout<<"Number1  =";
  cin>>TempNumber;
  objCalc->SetNumber1(TempNumber);
  cout<<"Number2  =";
  cin>>TempNumber;
  objCalc->SetNumber2(TempNumber);
}
int Calc::Mul(){
	return  Number1*Number2;
}


int Calc::Min(){
	return	Number1-Number2;
}

float Calc::MyDiv (){

	return Number1 /(float) Number2;

}
Topic archived. No new replies allowed.