Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Christian« (30.08.2004, 20:34)
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »-=)GWC(RaMsEs« (30.08.2004, 20:51)
Zitat
#include (iostream) // ( ) natürlich ersetzen
#include (cstdlib)
int main()
{
char a[20], b[20], c[20];
int w, x, y, z;
std::cout << "Geben Sie die 1. Zahl ein!";
std::cin >> a;
x = atoi(a);
std::cout << "Geben Sie die 2. Zahl ein!";
std::cin >> b;
y = atoi(b);
std::cout << "Geben Sie die 3. Zahl ein!";
std::cin >> c;
z = atoi(c);
w = x + y + z;
std::cout << w << std::endl;
return 0;
}
Zitat
#include (iostream) // ersetzen...
int main()
{
char a[20], b[20], c[20];
int w, x, y, z;
std::cout << "Geben Sie die 1. Zahl ein!";
std::cin.get(a, 20);
std::cin.clear();
std::cin.ignore( 1024, '\n' );
x = atoi(a);
std::cout << "Geben Sie die 2. Zahl ein!";
std::cin.get(b, 20);
std::cin.clear();
std::cin.ignore( 1024, '\n' );
y = atoi(b);
std::cout << "Geben Sie die 3. Zahl ein!";
std::cin.get(c, 20);
std::cin.clear();
std::cin.ignore( 1024, '\n' );
z = atoi(c);
w = x + y + z;
std::cout << w << std::endl;
return 0;
}