pastebin

Paste Search Dynamic
Recent pastes
Thetime
  1. // Lab 8, Working with structs
  2. // Programmer : Maiar Khattab
  3. // Editor(s) used : Code Blocks 13.12
  4. // Compiler(s) used : Code Blocks 13.12
  5.  
  6. #include<iostream>
  7. using std::cout;
  8. using std::endl;
  9.  
  10. #include<cstdlib>
  11.  
  12. //struct def
  13. struct tod
  14. {
  15. int hour;// the hr , 0-23
  16. int minute;// the min, 0-59
  17. int second;//the sec, 0-59
  18. char descr [32];//the description of the time of day
  19.  
  20. };
  21. //void printTod(const tod&);
  22. int main ()
  23. {
  24.   cout << "Lab 8, Working With structsn";
  25.   cout << "Programmer: Maiar Khattabn";
  26.   cout << "Editor(s) used: Code Blocks 13.12n";
  27.   cout << "Compiler(s) used: Code Blocks 13.12n";
  28.   cout << "File: " << __FILE__ << endl;
  29.   cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;
  30.  
  31.             tod theTime[] =  {{12,0,0, "noon"},
  32.             {0,0,0," midnight"},
  33.             {6,00,00," supper "},
  34.             {11,30,0,"bedtime"}};
  35.          
  36.           for(int i; i <5; i++)
  37.           {
  38.              char descr [32];                    
  39.             cout << theTime[i].descr << " is " << theTime[i].hour << ':'
  40.             << theTime[i].minute << ":" << theTime[i].second << endl;
  41.           }
  42. }
  43.      
  44.  
Parsed in 0.010 seconds