src/work/athos/xy/xy.cc
author deba
Wed, 08 Sep 2004 12:06:45 +0000
changeset 822 88226d9fe821
parent 240 4a1d2e642552
child 921 818510fa3d99
permissions -rw-r--r--
The MapFactories have been removed from the code because
if we use macros then they increases only the complexity.

The pair iterators of the maps are separeted from the maps.

Some macros and comments has been changed.
athos@201
     1
#include <xy.h>
athos@201
     2
#include <iostream>
athos@513
     3
#include <vector>
athos@201
     4
using namespace std;
athos@207
     5
using namespace hugo;
athos@513
     6
athos@513
     7
athos@201
     8
int main()
athos@201
     9
{
athos@207
    10
athos@240
    11
	cout << "Kérek szépen egy egész számot!" << endl;
athos@207
    12
	int s;
athos@207
    13
	cin >> s;
athos@207
    14
athos@207
    15
	cout << "Kerek sok sikvektort." << endl;
athos@201
    16
athos@201
    17
	xy<int> osszeg;
athos@207
    18
	xy<int> kul;
athos@201
    19
	xy<int> z;
athos@201
    20
athos@201
    21
	vector< xy<int> > v;
athos@207
    22
 
athos@201
    23
	while(cin >> z) {
athos@201
    24
		v.push_back(z);
athos@201
    25
		osszeg += z;
athos@207
    26
		kul -= z;
athos@201
    27
       		cout << "Az összeg aktualisan: " << osszeg << endl;
athos@207
    28
       		cout << "A különbség aktualisan: " << kul << endl;
athos@201
    29
	}
athos@201
    30
athos@201
    31
	cout << "A kovetkezo szamokat szoroztam ossze:" << endl;
athos@201
    32
	for(unsigned int i=0; i<v.size(); ++i) {
athos@201
    33
	  cout << v[i] << ", A normanégyzete: " << v[i].normSquare() <<endl;
athos@207
    34
	  cout << v[i] << " " << s << " szorosa " << v[i]*s <<endl;
athos@207
    35
	  cout << v[i] << " " << s << " edrésze " << v[i]/s <<endl;
athos@201
    36
	}
athos@207
    37
	if (v.size()>1){
athos@207
    38
	  cout << "Az elsö kettö szorzata: " << v[0]*v[1] << endl;
athos@207
    39
	}
athos@207
    40
	
athos@201
    41
	cout << "Eleg nehez volt." << endl;
athos@201
    42
}