Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- //Adatok beolvasása
- {
- int n, m;
- do {
- cout << "Telepulesek szama: ";
- cin >> n;
- } while (n <= 0);
- do {
- cout << "Napok szama: ";
- cin >> m;
- } while (m <= 0);
- float homerseklet[n][m];
- cout << endl << "Idojaras elorejezesek beolvasasa" << endl;
- cout << endl;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < m; ++j) {
- do {
- cout << "Kerem a " << i + 1 << ". varosnak a(z) " << j + 1 << ". napi legmagasabb homersekletet: ";
- cin >> homerseklet[i][j];
- } while (homerseklet[i][j] < -89.2 || homerseklet[i][j] > 58);
- }
- cout << endl;
- }
- //Eredmény kiszámoltatása
- int db = 0;
- int i = 0;
- int napok[db];
- for (int j = 1; j < n; ++j) {
- while (homerseklet[i][j - 1] < homerseklet[i][j] && i < m) {
- i = i + 1;
- }
- if (i == n) {
- db = db + 1;
- napok[db - 1] = j + 1;
- cout << db << endl;
- }
- i = 0;
- }
- //Eredmény kiiratása
- if (db > 0) {
- cout << "Eze(ke)n a nap(ok)on minden varosban nagyobb a homerseklet mint az elozo napon: ";
- for (int i = 0; i < db; ++i) {
- cout << napok[i] << ".nap ";
- }
- } else {
- cout << "Nincs olyan nap amikor minden varosban nagyobb a homerseklet mint az elozo napon";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement