jelenpivo123

programiranje 2 zadatak 1

Sep 23rd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9. //unos informacija
  10. cout<<"Unesite informacije o osobama: ime, prezime, maticni" <<endl;
  11. string ime;
  12. string prezime;
  13. string maticnibroj;
  14. cout<<"Unesite ime osobe: " <<endl;
  15. cin>>ime;
  16.  
  17. cout<<"Unesite prezime osobe: " <<endl;
  18. cin>>prezime;
  19.  
  20. cout<<"Unesite maticni broj osobe: " <<endl;
  21. cin>>maticnibroj;
  22.  
  23.  
  24. string id;
  25.  
  26. id=ime.substr(0,1)+prezime.substr(0,1)+maticnibroj.substr(0,3);
  27.  
  28. /* provjeriIme(ime);
  29. */
  30. cout<<"ID je "<<id<<endl;
  31.  
  32. system("Pause");
  33. return 0;
  34.  
  35. }
  36. bool provjeriIme(string ime){
  37. bool provjera=true;
  38. for(int i=0; i<=ime.length();i++){
  39. if(!isalpha(ime[i])){
  40. provjera=false;
  41. break;
  42. }else{
  43. return provjera;
  44. cout<<"dobra"<<endl;
  45. }
  46.  
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment