Created
October 25, 2016 09:42
-
-
Save horvathgyozo/ece9455ceb6384daa1a404ec337820d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void beolvas(int &n, string sz[100+1]) { | |
//2. be | |
bool jo; | |
do { | |
cout << "N="; | |
cin >> n; | |
jo = n>=0 && n<=100; | |
if (!jo) { | |
cout << "Nem jo" << endl; | |
} | |
} while(!jo); | |
for (int i = 1; i<=n; i++) { | |
do { | |
cout << i << ". szsz: "; | |
cin >> sz[i]; | |
jo = sz[i].length() == 1 && | |
(sz[i][0] == '1' || | |
sz[i][0] == '2'); | |
if (!jo) { | |
cout << "Nem jo" << endl; | |
} | |
} while(!jo); | |
} | |
} | |
void eldontes(const int n, const string sz[100+1], | |
bool &ferfi) { | |
//3. feld, alg | |
int i = 1; | |
while (i<=n && sz[i][0]!='1') { | |
i = i + 1; | |
} | |
ferfi = i<=n; | |
} | |
void kiir(const bool ferfi) { | |
//4. ki | |
if (ferfi) { | |
cout << "Van ffi" << endl; | |
} else { | |
cout << "Nincs ffi" << endl; | |
} | |
} | |
int main() | |
{ | |
//1. dekl, beki | |
int n; //be | |
string sz[100+1]; //be | |
bool ferfi; //ki | |
beolvas(n, sz); | |
eldontes(n, sz, ferfi); | |
kiir(ferfi); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment