Hertebeest
Gebruiker
- Lid geworden
- 10 mrt 2007
- Berichten
- 37
Ik ben een beetje bezig met keuzes, en ik snap niet precies waarom dit niet werkt.
Iemand?
Ook heb ik dit geprobeerd
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char Y;
char N;
int choice;
cout << "Want to continue? [Y/N]";
cin >> choice;
if (choice == Y)
{
cout << "Oke" << endl;
}
if (choice == N)
{
cout << "No" << endl;
}
cout << "Bye" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Iemand?
Ook heb ik dit geprobeerd
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char Y;
char N;
int choice;
cout << "Want to continue? [Y/N]";
cin >> choice;
for (; choice == Y; )
{
cout << "Oke" << endl;
}
for (;choice == N ;)
{
cout << "No" << endl;
}
cout << "Bye" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Laatst bewerkt: