Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include "Televizor.h"
- using namespace std;
- void Televizor::proveriBroj(){
- //ispravan ako ima 10 karaktera
- bool provera = true;
- if(this->serijskiBroj.length() == 10){
- for(int i=0; i<serijskiBroj.length(); i++){
- string malaSlova = serijskiBroj.substr(0,4);
- string velikaSlova = serijskiBroj.substr(4,4);
- string brojevi = serijskiBroj.substr(8,2);
- for(int i=0; i<malaSlova.length(); i++){
- if(!islower(malaSlova.at(i))){
- provera = false;
- }
- }
- for(int i=0; i<velikaSlova.length(); i++){
- if(!isupper(velikaSlova.at(i))){
- provera = false;
- }
- }
- for(int i=0; i<brojevi.length(); i++){
- if(!isdigit(brojevi.at(i))){
- provera = false;
- }
- }
- }
- }else{
- provera = false;
- }
- if(provera){
- cout<<"Ispravan serijski broj"<<endl;
- }else{
- cout<<"Serijski broj nije ispravan"<<endl;
- }
- }
- void Televizor::ispisiPodatke(){
- 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;
- }
- Televizor::Televizor(){
- }
- 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) {
- this->tezina = tezina;
- this->serijskiBroj = serijskiBroj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement