Skip to content

Instantly share code, notes, and snippets.

@horvathgyozo
Created October 14, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horvathgyozo/284c68275882c4eec86dcfe6f957d191 to your computer and use it in GitHub Desktop.
Save horvathgyozo/284c68275882c4eec86dcfe6f957d191 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
//1. dekl
int n;
const int MAXN = 100;
int evek[MAXN+1];
int aktev;
bool vanekk;
//2. be
bool jo;
cout << "Akt.ev: ";
cin >> aktev;
do {
cout << "Hany fo (0 es " << MAXN << " kozott): ";
cin >> n;
jo = n>=0 && n<=MAXN;
if (!jo) {
cout << "Nem jo" << endl;
}
} while (!jo);
for (int i=1; i<=n; i++) {
do {
cout << i << ". szulev: ";
cin >> evek[i];
jo = evek[i]<=aktev && evek[i]>1900;
if (!jo) {
cout << "Nem jo" << endl;
}
} while(!jo);
}
//3. feld, alg
int i = 1;
while (i<=n && !(aktev - evek[i]<=18)) {
i = i + 1;
}
vanekk = i<=n;
//4. ki
// cout << (vanekk ? "Van" : "Nincs") << " kk" << endl;
if (vanekk) {
cout << "Van kk" << endl;
} else {
cout << "Nincs kk" << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment