Advertisement
jelenpivo123

televizor. cpp

Oct 5th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include "Televizor.h"
  4.  
  5. using namespace std;
  6.  
  7. void Televizor::proveriBroj(){
  8.  
  9. //ispravan ako ima 10 karaktera
  10. bool provera = true;
  11. if(this->serijskiBroj.length() == 10){
  12.  
  13. for(int i=0; i<serijskiBroj.length(); i++){
  14.  
  15. string malaSlova = serijskiBroj.substr(0,4);
  16. string velikaSlova = serijskiBroj.substr(4,4);
  17. string brojevi = serijskiBroj.substr(8,2);
  18.  
  19. for(int i=0; i<malaSlova.length(); i++){
  20.  
  21. if(!islower(malaSlova.at(i))){
  22.  
  23. provera = false;
  24. }
  25. }
  26.  
  27. for(int i=0; i<velikaSlova.length(); i++){
  28.  
  29. if(!isupper(velikaSlova.at(i))){
  30.  
  31. provera = false;
  32. }
  33. }
  34.  
  35. for(int i=0; i<brojevi.length(); i++){
  36.  
  37. if(!isdigit(brojevi.at(i))){
  38.  
  39. provera = false;
  40. }
  41. }
  42. }
  43.  
  44.  
  45. }else{
  46.  
  47. provera = false;
  48. }
  49.  
  50. if(provera){
  51.  
  52. cout<<"Ispravan serijski broj"<<endl;
  53. }else{
  54.  
  55. cout<<"Serijski broj nije ispravan"<<endl;
  56. }
  57.  
  58. }
  59.  
  60. void Televizor::ispisiPodatke(){
  61.  
  62. cout<<"Proizvodjac: " <<this->proizvodjac << "Model: "<<this->model <<"Godina proizvodnje: "<<this->godinaProizvodnje <<"Velicina ekrana: " <<this->velicinaEkrana <<"Tip ekrana: " <<this->tipEkrana <<"Broj boja: "<<this->brojBoja<<"Tezina: " <<this->tezina<<"Serijski broj: "<<this->serijskiBroj<<endl;
  63. }
  64.  
  65. Televizor::Televizor(){
  66.  
  67. }
  68.  
  69.  
  70.  
  71. Televizor::Televizor(string proizvodjac, string model, int godinaProizvodnje,int velicinaEkrana, string tipEkrana, string brojBoja,int tezina, string serijskiBroj) : Uredjaj(proizvodjac,model,godinaProizvodnje),Ekran(velicinaEkrana,tipEkrana,brojBoja) {
  72.  
  73. this->tezina = tezina;
  74. this->serijskiBroj = serijskiBroj;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement