Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
polja_z4.cpp
00001 #include <iostream> 00002 #include <cstdlib> 00003 00004 00005 using namespace std; 00006 00007 00008 int uvjet1 (char u1){ 00009 00010 if (u1 == 'A' || u1 == 'B' || u1 == 'C'){ 00011 return 1; 00012 } else { 00013 return 0; 00014 } 00015 } 00016 00017 int uvjet2 (char u2, char u3){ 00018 00019 u2 = u2 - '0'; 00020 u3 = u3 - '0'; 00021 if (u2 >= 1 && u2 <= 4){ 00022 if (u3 >=0 && u3 <=9){ 00023 return 1; 00024 } 00025 } else { 00026 return 0; 00027 } 00028 } 00029 00030 int uvjet3 (char u4){ 00031 00032 if (u4 >= 97 && u4 <= 122){ 00033 return 1; 00034 } else { 00035 return 0; 00036 } 00037 } 00038 00039 int uvjet4 (char u5, char u6){ 00040 00041 u5 = u5 - '0'; 00042 u6 = u6 - '0'; 00043 if (u5 >= 3 && u5 <= 7){ 00044 if (u6 >=3 && u6 <=7){ 00045 return 1; 00046 } 00047 } else { 00048 return 0; 00049 } 00050 } 00051 00052 00053 int main (){ 00054 00055 int u1, u2, u3, u4, u5, u6; 00056 char sifra[6]; 00057 00058 do { 00059 cout << "Upisi sifru prema uputama: "; 00060 cin >> sifra; 00061 u1 = uvjet1(sifra[0]); 00062 u2 = uvjet2(sifra[1], sifra[2]); 00063 u3 = uvjet3(sifra[3]); 00064 u4 = uvjet4(sifra[4], sifra[5]); 00065 00066 00067 } while (u1 != 1 || u2 != 1 || u3 != 1 || u4 != 1); 00068 00069 00070 cout << u1 <<" "<< u2 << " "<< u3 <<" "<< u4; 00071 00072 cout << endl <<"Uspjesno unesena sifra"; 00073 00074 } 00075
Generated on Thu Jul 14 2022 21:05:48 by
1.7.2