Пример #1
0
int main()
{
	int counter = 0;
	while (counter != 2)
	{
		std::unique_ptr<Automat> device_ptr(new Automat);
		vector<Automat> Vdevice(2);
		Automat device;
		// Initialisieren
		device_ptr->init(10000, "Bonn, Hauptstraße 123");

		Vdevice[0].init(20000, "Augsburg, Fuggerweg 345");
		Vdevice[1].set_geld(25000);
		Vdevice[1].set_standort("Berlin, Berliner Allee 567");

		device.init(123456, "Frankfurt, Goethestraße 123");

		// Ausgabe
		cout << device_ptr->get_geld() << endl;
		cout << device_ptr->get_standort() << endl;

		for (size_t i = 0; i < Vdevice.size(); i++)
		{
			cout << Vdevice[i].get_geld() << endl;
			cout << Vdevice[i].get_standort() << endl;
		}
		cout << device.get_geld() << endl;
		cout << device.get_standort() << endl;
		counter++;
	}
	return 0;
}
Пример #2
0
int main (int argc, char* argv[]){
Automat* automat = new Automat();
Buffer* inBuffer = new Buffer("../readFile.txt");
Buffer* outBuffer = new Buffer("../wirteFile.txt");
autoContainer* con = new autoContainer();

	while(inBuffer->hasNext()){

		if(automat->hasToken()){
			con = automat->getCurrentContainer();
			if(con->getType() != 0){
				inBuffer->ungetChar();
			}
			for(int i = 0; i < con->getLength(); i++){
				inBuffer->ungetChar();
			}
			for(int i = 0; i < con->getLength(); i++){
				outBuffer->putChar(inBuffer->getChar());
			}
			outBuffer->putChar('\n');
		}
		automat->read(inBuffer->getChar());
	}

}
Пример #3
0
// Funktionsdefinition
bool diffAutomat(const Automat &a1, const Automat &a2) {
  if( a1.get_standort() == a2.get_standort() ) {
    return true;
  }
  else {
    return false;
  }
}
Пример #4
0
// Funktionsdefinition
bool diffAutomat(Automat a1, Automat a2) {
  if( a1.get_standort() == a2.get_standort() ) {
    return true;
  }
  else {
    return false;
  }
}
Пример #5
0
// Funktionsdefinition
bool Automat::diffAutomat(const Automat &a1) {
  if( get_standort() == a1.get_standort() ) {
    return true;
  }
  else {
    return false;
  }
}
Пример #6
0
Automat Automat::diffGeld(const Automat& a1) {
  if( get_geld() > a1.get_geld() ) {
    return *this;
  }
  else { return a1; }
}
Пример #7
0
Automat diffGeld(const Automat& a1, const Automat& a2) {
  if( a1.get_geld() > a2.get_geld() ) {
    return a1;
  }
  else { return a2; }
}
Пример #8
0
int main(int argc, char** argv)
{
	full_argc(argc);
	Automat a;
	int c;
	Lexeme_list *list;
	c = getchar();
	try {
		for (;;) {
			if (c==EOF) break;
			a.feed_char(c);
			a.run();
			if (a.full_lex())
				a.add_new_elem();
			if (a.use_prev==0) {
				if (c=='\n')
					a.inc_nstr();
				c = getchar();
			}
			if (a.is_long()) throw "too long name";
		}
	}
	catch (const char *s) {
		printf("Error: %s\n", s);
		return 1;
	}
	a.print_list();
	if (a.is_any_errors()) {
		printf("Some lexical errors detected!\n");
		return 1;
	}
	list = a.get_list();
	PolizItem *lst;
	LabelTable *lable_lst;
	VarTable *var_lst;
	SyntaxAnalyzer s;
	s.set_list(list);
	try {
		s.analyze();
		printf("SUCCESSFULL ANALYZATION!!!\n\n");
		lst = s.poliz_list;
		lable_lst = s.label_list;
	}
	catch (const Exeption &ex) {
		printf("Error: %s\nbut found %s\nstr# %d\n",
			ex.GetComment(), ex.GetLexeme(), ex.GetNstr());
		return 1;
	}
	lprint(lst);
	server.set(atoi(argv[2]), argv[1]);
	server.connection();
	robot.set(argv, server);
	robot.readnsend_name();
	robot.join_or_create();
	printf("start playing\n");
	robot.start_easy_game(lst);
	var_lst = PolizElem::Get_var_table();
	delete_var_list(var_lst);
	delete_label_list(lable_lst);
	delete_poliz_list(lst);
	return 0;
}