#include <iostream>
#include "windows.h"
using namespace std;
float main(){
float a,x,y,erg;
char ch[4];
x==0.0;
cout<<"Gib die 1.zahl ein:\t"<<endl;
cin>>x;
for(a=2; a<1000000; a++)
{
cout<<"Gib die "<<a<<". Zahl ein:\t"<<endl;
cin>>y&&ch;
erg = x+=y;
cout<<" "<<x<<" + "<<y<<" = "<<erg<<endl<<endl<<endl;
if (ch == "end")
{
break;
}
}
return 0;
system("PAUSE");
}
Also ich möchte das wenn man end eingibt die schleife beendet wir aber statt aus der for schleife zu springen zählt das programm bis 1000000.
Ist break die falsche funktion oder was mach ich falsch ?
Danke