Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool Unos(){
  6.  
  7. cout<<"Vrsimo unos"<<endl;
  8. char space;
  9. while(cin.peek()==' ')cin.get(space);
  10.  
  11.  
  12. char a;
  13. cin.get(a);
  14.  
  15. if(a=='A'){
  16.  
  17. char b;
  18. cin.get(b);
  19. if(b=='+')
  20. if(cin.peek()==' ' || cin.peek()=='\n')
  21. cout<<"Ovdje radi sta treba za A+"<<endl;
  22. else cout<<"Ovdje radi sta treba za suvisan parametar A+"<<endl;
  23. else if(b=='-')
  24. if(cin.peek()==' ' || cin.peek()=='\n')
  25. cout<<"Ovdje radi sta treba za A-"<<endl;
  26. else cout<<"Ovdje radi sta treba za suvisan parametar A-"<<endl;
  27. else cout<<"Ovdje radi sta treba za pogresnu komandu"<<endl;
  28. }
  29. else if(a=='L'){
  30. if(cin.peek()==' ' || cin.peek()=='\n')
  31. cout<<"Ovdje radi sta treba za L"<<endl;
  32. else cout<<"Ovdje radi sta treba za suvisan parametar L"<<endl;
  33. }
  34.  
  35. else if(a=='D'){
  36. if(cin.peek()==' ' || cin.peek()=='\n')
  37. cout<<"Ovdje radi sta treba za D"<<endl;
  38. else cout<<"Ovdje radi sta treba za suvisan parametar D"<<endl;
  39. }
  40.  
  41. else if(a=='K'){
  42. if(cin.peek()==' ' || cin.peek()=='\n')
  43. cout<<"Ovdje radi sta treba za K"<<endl;
  44. else cout<<"Ovdje radi sta treba za suvisan parametar K"<<endl;
  45. }
  46.  
  47. else if(a=='I'){
  48. int korak=0;
  49. if(cin.peek()==' ' || cin.peek()=='\n'){
  50. cout<<"Ovdje radi sta treba za nedostaje parametar I"<<endl;
  51. }
  52.  
  53. else{
  54. if(cin.peek()>='0' && cin.peek()<='9'){
  55. while(cin.peek()>='0' && cin.peek()<='9'){
  56. char cifra;
  57. cin.get(cifra);
  58. korak=korak*10+(cifra-'0');
  59. }
  60. if(cin.peek()==' ' || cin.peek()=='\n')
  61. cout<<"Broj je "<<korak<<endl;
  62. else cout<<"Ovdje radi sta treba za pogresan parametar I"<<endl;
  63. }
  64. else cout<<"Ovdje radi sta treba za pogresan parametar I"<<endl;
  65. }
  66. }else cout<<"Ovdje radi sta treba za ne postoji komanda"<<endl;
  67.  
  68. while(cin.peek()!='\n')cin.get(space);
  69.  
  70.  
  71.  
  72. }
  73.  
  74. int main()
  75. {
  76.  
  77.  
  78.  
  79.  
  80. while(1){
  81.  
  82.  
  83. Unos();
  84. cin.get();
  85.  
  86. }
  87.  
  88.  
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement