cmk
Benutzertitel:
HIer die neue Fassung
c++ macht irgendwie spass - ist alles noch sehr primitiv ich weiß - aber ich finde ein kleines nützliches platzsparendes tool
eine frage: wenn ich 5 / 2 rechne, dann kommt 2 raus weil int keine fließkommazahlen unterstüzt - welcher typ unterstützt das?
/***************************************************************************
main.cpp - description
-------------------
begin : Mon Oct 28 19:35:48 CET 2002
copyright : (C) 2002 by Christian Kienle AND unixboard.de MEMBERS
email : **********
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int a,b,c;
/*
a == ERSTE EINGABE
b == ZWEITE EINGABE
c == ERGEBNIS
*/
int status = 1;
/*
status == EXIT OR NOT
*/
char op;
/*
op == OPERATOR
*/
cout << "##### FuselCalc 0.4 #####\n\n";
cout << "ENTER A NUMBER AND THEN PRESS ENTER: ";
cin >> a;
cout << "OPERATOR EG: (/,*.-,+): ";
cin >> op;
cout << "ENTER ANOTHER NUMBER AND THEN PRESS ENTER: ";
cin >> b;
switch ( op )
{
case '/' : c = a/b; break;
case '*' : c = a*b; break;
case '-' : c = a-b; break;
case '+' : c = a+b; break;
}
/*
HERAUSFINDEN WELCHER OPERATOR VERWENDET WURDE
*/
cout << "\n**************************************************************";
cout << "\nRESULT OF:\n";
cout << a;
cout << " ";
cout << op;
cout << " ";
cout << b;
cout << " = ";
cout << c;
cout << "\n**************************************************************";
while(status != 2)//SOLGANGE WEITERRECHEN WIE status != 2
{
cout << "\n\nGOING ON? PRESS ANY INT FOR YES OR PRESS [2] FOR EXIT: ";
cin >> status;
if(status != 2)//status != 2 ALSO WEITER MACHEN
{
cout << "\n\nOPERATOR EG: (/,*.-,+): ";
cin >> op;
cout << "ENTER A NUMBER AND THEN PRESS ENTER: ";
cin >> b;
switch ( op )
{
case '/' : c = c/b; break;
case '*' : c = c*b; break;
case '-' : c = c-b; break;
case '+' : c = c+b; break;
}
/*
HERAUSFINDEN WELCHER OPERATOR VERWENDET WURDE
*/
cout << "\n**************************************************************";
cout << "\nNEW RESULT: ";
cout << c;
cout << "\n**************************************************************";
}
else //WENN status == 2 DANN EXIT
{
cout << "\n\nTHANK YOU FOR USING FuselCalc 0.4";
}
}
return 0;
}
c++ macht irgendwie spass - ist alles noch sehr primitiv ich weiß - aber ich finde ein kleines nützliches platzsparendes tool
eine frage: wenn ich 5 / 2 rechne, dann kommt 2 raus weil int keine fließkommazahlen unterstüzt - welcher typ unterstützt das?
/***************************************************************************
main.cpp - description
-------------------
begin : Mon Oct 28 19:35:48 CET 2002
copyright : (C) 2002 by Christian Kienle AND unixboard.de MEMBERS
email : **********
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int a,b,c;
/*
a == ERSTE EINGABE
b == ZWEITE EINGABE
c == ERGEBNIS
*/
int status = 1;
/*
status == EXIT OR NOT
*/
char op;
/*
op == OPERATOR
*/
cout << "##### FuselCalc 0.4 #####\n\n";
cout << "ENTER A NUMBER AND THEN PRESS ENTER: ";
cin >> a;
cout << "OPERATOR EG: (/,*.-,+): ";
cin >> op;
cout << "ENTER ANOTHER NUMBER AND THEN PRESS ENTER: ";
cin >> b;
switch ( op )
{
case '/' : c = a/b; break;
case '*' : c = a*b; break;
case '-' : c = a-b; break;
case '+' : c = a+b; break;
}
/*
HERAUSFINDEN WELCHER OPERATOR VERWENDET WURDE
*/
cout << "\n**************************************************************";
cout << "\nRESULT OF:\n";
cout << a;
cout << " ";
cout << op;
cout << " ";
cout << b;
cout << " = ";
cout << c;
cout << "\n**************************************************************";
while(status != 2)//SOLGANGE WEITERRECHEN WIE status != 2
{
cout << "\n\nGOING ON? PRESS ANY INT FOR YES OR PRESS [2] FOR EXIT: ";
cin >> status;
if(status != 2)//status != 2 ALSO WEITER MACHEN
{
cout << "\n\nOPERATOR EG: (/,*.-,+): ";
cin >> op;
cout << "ENTER A NUMBER AND THEN PRESS ENTER: ";
cin >> b;
switch ( op )
{
case '/' : c = c/b; break;
case '*' : c = c*b; break;
case '-' : c = c-b; break;
case '+' : c = c+b; break;
}
/*
HERAUSFINDEN WELCHER OPERATOR VERWENDET WURDE
*/
cout << "\n**************************************************************";
cout << "\nNEW RESULT: ";
cout << c;
cout << "\n**************************************************************";
}
else //WENN status == 2 DANN EXIT
{
cout << "\n\nTHANK YOU FOR USING FuselCalc 0.4";
}
}
return 0;
}