{"id":153,"date":"2012-03-02T07:53:51","date_gmt":"2012-03-02T06:53:51","guid":{"rendered":"http:\/\/csipet.web.elte.hu\/?p=153"},"modified":"2012-03-02T07:53:51","modified_gmt":"2012-03-02T06:53:51","slug":"3-het","status":"publish","type":"post","link":"https:\/\/peter.csonka.hu\/hu\/blog\/2012\/03\/3-het\/","title":{"rendered":"3. h\u00e9t"},"content":{"rendered":"<p><a href=\"https:\/\/docs.google.com\/document\/d\/1B-kSmTuQu89YU8XOb72IlyRp3PL1NpzvBGdLt4UxfcE\/edit\">https:\/\/docs.google.com\/document\/d\/1B-kSmTuQu89YU8XOb72IlyRp3PL1NpzvBGdLt4UxfcE\/edit<\/a><\/p>\n<pre lang=\"c\" line=\"1\">\n#include <iostream>\n#include <vector>\n#include <cstdlib>\n\nusing namespace std;\n\nvoid beolvasas(vector< vector<int> > &jegyek);\nint beolvas_egesz(const string uzenet, const string hibauzenet);\nint beolvas_jegy(const int i, const int j);\nbool fel11a(const vector< vector<int> > jegyek);\nbool csupaotos(const int i, const vector< vector<int> > jegyek);\n\nint main(){\n\tvector< vector<int> > jegyek; \/\/ a k\u00e9t z\u00e1r\u00f3 kacsacs\u00f5r k\u00f6z\u00e9 mindenk\u00e9pp kell a sz\u00f3k\u00f6z\n\tbool van;\n\n\tbeolvasas(jegyek);\n\tvan = fel11a(jegyek);\n\tif (van){\n    \tcout << \"Van\" << endl;\n\t} else {\n    \tcout << \"Nincs\" << endl;\n\t}\n\n\treturn 0;\n}\nbool fel11a(const vector< vector<int> > jegyek){\n\tint i=0;\n\tint n=jegyek.size();\n\twhile(i<=(n-1) &#038;&#038; !csupaotos(i, jegyek)){\n    \ti++;\n\t}\n\treturn i<=n-1;\n}\nbool csupaotos(const int i, const vector< vector<int> > jegyek){\n\tint j=0;\n\tint m=jegyek[i].size();\n\twhile((j<=(m-1)) &#038;&#038; (jegyek[i][j]==5)){\n    \tj++;\n\t}\n\treturn j>(m-1);\n}\n\nvoid beolvasas(vector< vector<int> > &jegyek){\n\tint n, m;\n\n\tn = beolvas_egesz(\"Hany diak: \", \"Nem negativ kell!\");\n\tm = beolvas_egesz(\"Hany targy: \", \"Nem negativ kell!\");\n\n\tjegyek.resize(n);\n\tfor(int i=0; i<n; i++){\n    \tjegyek[i].resize(m);\n    \tfor(int j=0; j<m; j++){\n        \tjegyek[i][j] = beolvas_jegy(i,j);\n    \t}\n\t}\n}\nint beolvas_egesz(const string uzenet, const string hibauzenet){\n\tint n;\n\tbool hiba;\n\n\tdo{\n    \tcout << uzenet;\n    \tstring str;\n    \tcin >> str;\n    \tn = atoi(str.c_str()); \/\/ atof float-hoz\n    \thiba = n==0 && str!=\"0\" || n<0;\n    \tif(hiba){\n        \tcout << hibauzenet << endl;\n    \t}\n\t} while(hiba);\n\n\treturn n;\n}\nint beolvas_jegy(const int i, const int j){\n\tint n;\n\tbool hiba;\n\n\tdo{\n    \tcout << i+1 << \". diak \" << j+1 << \". jegye: \";\n    \tstring str;\n    \tcin >> str;\n    \tn = atoi(str.c_str()); \/\/ atof float-hoz\n    \thiba = n==0 && str!=\"0\" || n<1 || n>5;\n    \tif(hiba){\n        \tcout << \"1 es 5 kozott kell lennie!\" << endl;\n    \t}\n\t} while(hiba);\n\n\treturn n;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/docs.google.com\/document\/d\/1B-kSmTuQu89YU8XOb72IlyRp3PL1NpzvBGdLt4UxfcE\/edit #include #include #include using namespace std; void beolvasas(vector< vector > &#038;jegyek); int beolvas_egesz(const string uzenet, const string hibauzenet); int beolvas_jegy(const int i, const int j); bool fel11a(const vector< vector > jegyek); bool csupaotos(const int i, const vector< vector > jegyek); int main(){ vector< vector > jegyek; \/\/ a k\u00e9t z\u00e1r\u00f3 kacsacs\u00f5r k\u00f6z\u00e9 mindenk\u00e9pp kell a sz\u00f3k\u00f6z bool van; beolvasas(jegyek); van = fel11a(jegyek); if (van){ cout<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","hentry","category-programozasi-alapismeretek-2"],"_links":{"self":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":0,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"wp:attachment":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}