Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- class klasa{
- public:
- int a, b;
- double c;
- double funkcja(int zmienna){
- return c * zmienna;
- }
- };
- class czas{
- int godz, min, sec;
- public:
- void ZAPAMIETAJCZAS (int g, int m, int s){
- godz=g;
- min=m;
- sec=s;
- }
- void ZAPAMIETAJCZAS (char *cz){
- sscanf(cz,"%2d:%2d:%2d", &godz, &min, &sec);
- }
- void ZWROCCZAS (int &g, int &m, int &s){
- g = godz;
- m = min;
- s = sec;
- }
- void ZWROCCZAS (char *cz){
- sprintf(cz, "%2d:%2d:%2d", godz, min, sec);
- }
- };
- int main(){
- /*class klasa g;
- g.c=10;
- int a1=89;
- double zm1;
- zm1= g.funkcja(a1);
- cout <<zm1;
- cout << endl;
- return 0;
- */
- int z1=223;
- int z2=1322;
- int z3=1333;
- char bufor[100]="CZAS: ";
- char czas[]="21:37:05";
- class czas zegar;
- zegar.ZAPAMIETAJCZAS(21,32,13);
- zegar.ZWROCCZAS(z1,z2,z3);
- cout <<z1 <<":" <<z2 <<":" <<z3;
- zegar.ZAPAMIETAJCZAS(czas);
- zegar.ZWROCCZAS(bufor);
- cout << endl << bufor;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement