lecz nie udaje się..
Próbuję w ten sposob:
Kod: Zaznacz cały
#include <iostream>
using namespace std;
main()
{
int b,i,n;
#
bool a;
a = false;
cin >> b;
do
{
if ((b==42) && (a == true)) break;
if (b==42) a = true;
else a= false;
cout<<b<<endl;
}
while (b == EOF);
}
Kod: Zaznacz cały
#include <iostream>
using namespace std;
main()
{
int b,i,n;
bool a;
a = false;
while(cin >> b)
{
if(b == EOF) break; //probowalem tez zamiast tej linijki tego: if(cin.peek() == EOF) break;
if ((b==42) && (a == true)) break;
if (b==42) a = true;
else a= false;
cout<<b<<endl;
}
}
Kod: Zaznacz cały
#include <iostream>
using namespace std;
main()
{
int b,i,n;
bool a;
a = false;
while(~scanf("%d", &n)){
cin>>b;
if ((b==42) && (a == true)) break;
if (b==42) a = true;
else a= false;
cout<<b<<endl;
}
}
Pomoze ktos?
Pozdrawiam