// Lab 8, Working with structs
// Programmer : Maiar Khattab
// Editor(s) used : Code Blocks 13.12
// Compiler(s) used : Code Blocks 13.12
#include<iostream>
using std:: cout ;
using std:: endl ;
#include<cstdlib>
//struct def
struct tod
{
int hour; // the hr , 0-23
int minute; // the min, 0-59
int second; //the sec, 0-59
char descr [ 32 ] ; //the description of the time of day
} ;
//void printTod(const tod&);
int main ( )
{
cout << "Lab 8, Working With structs\n " ;
cout << "Programmer: Maiar Khattab\n " ;
cout << "Editor(s) used: Code Blocks 13.12\n " ;
cout << "Compiler(s) used: Code Blocks 13.12\n " ;
cout << "File: " << __FILE__ << endl;
cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;
tod theTime[ ] = { { 12 ,0 ,0 , "noon" } ,
{ 0 ,0 ,0 ," midnight" } ,
{ 6 ,00 ,00 ," supper " } ,
{ 11 ,30 ,0 ,"bedtime" } } ;
for ( int i; i < 5 ; i++ )
{
char descr [ 32 ] ;
cout << theTime[ i] .descr << " is " << theTime[ i] .hour << ':'
<< theTime[ i] .minute << ":" << theTime[ i] .second << endl;
}
}
IC8vIExhYiA4LCBXb3JraW5nIHdpdGggc3RydWN0cwovLyBQcm9ncmFtbWVyIDogTWFpYXIgS2hhdHRhYgovLyBFZGl0b3IocykgdXNlZCA6IENvZGUgQmxvY2tzIDEzLjEyCi8vIENvbXBpbGVyKHMpIHVzZWQgOiBDb2RlIEJsb2NrcyAxMy4xMgoKI2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIHN0ZDo6Y291dDsKdXNpbmcgc3RkOjplbmRsOwoKI2luY2x1ZGU8Y3N0ZGxpYj4KCi8vc3RydWN0IGRlZgpzdHJ1Y3QgdG9kCnsKaW50IGhvdXI7Ly8gdGhlIGhyICwgMC0yMwppbnQgbWludXRlOy8vIHRoZSBtaW4sIDAtNTkKaW50IHNlY29uZDsvL3RoZSBzZWMsIDAtNTkKY2hhciBkZXNjciBbMzJdOy8vdGhlIGRlc2NyaXB0aW9uIG9mIHRo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dDsgJmx0OyZsdDsgX19USU1FX18gJmx0OyZsdDsgZW5kbCAmbHQ7Jmx0OyBlbmRsOwoKICAgICAgICAgICAgdG9kIHRoZVRpbWVbXSA9ICB7ezEyLDAsMCwgJnF1b3Q7bm9vbiZxdW90O30sCiAgICAgICAgICAgIHswLDAsMCwmcXVvdDsgbWlkbmlnaHQmcXVvdDt9LAogICAgICAgICAgICB7NiwwMCwwMCwmcXVvdDsgc3VwcGVyICZxdW90O30sCiAgICAgICAgICAgIHsxMSwzMCwwLCZxdW90O2JlZHRpbWUmcXVvdDt9fTsKICAgICAgICAgIAogICAgICAgICAgZm9yKGludCBpOyBpICZsdDs1OyBpKyspCiAgICAgICAgICB7CiAgICAgICAgICAgICBjaGFyIGRlc2NyIFszMl07ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgY291dCAmbHQ7Jmx0OyB0aGVUaW1lW2ldLmRlc2NyICZsdDsmbHQ7ICZxdW90OyBpcyAmcXVvdDsgJmx0OyZsdDsgdGhlVGltZVtpXS5ob3VyICZsdDsmbHQ7ICc6JyAKICAgICAgICAgICAgJmx0OyZsdDsgdGhlVGltZVtpXS5taW51dGUgJmx0OyZsdDsgJnF1b3Q7OiZxdW90OyAmbHQ7Jmx0OyB0aGVUaW1lW2ldLnNlY29uZCAmbHQ7Jmx0OyBlbmRsOyAKICAgICAgICAgIH0KfQogICAgICAKICA=
// Lab 8, Working with structs
// Programmer : Maiar Khattab
// Editor(s) used : Code Blocks 13.12
// Compiler(s) used : Code Blocks 13.12
#include<iostream>
using std::cout;
using std::endl;
#include<cstdlib>
//struct def
struct tod
{
int hour;// the hr , 0-23
int minute;// the min, 0-59
int second;//the sec, 0-59
char descr [32];//the description of the time of day
};
//void printTod(const tod&);
int main ()
{
cout << "Lab 8, Working With structs\n";
cout << "Programmer: Maiar Khattab\n";
cout << "Editor(s) used: Code Blocks 13.12\n";
cout << "Compiler(s) used: Code Blocks 13.12\n";
cout << "File: " << __FILE__ << endl;
cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;
tod theTime[] = {{12,0,0, "noon"},
{0,0,0," midnight"},
{6,00,00," supper "},
{11,30,0,"bedtime"}};
for(int i; i <5; i++)
{
char descr [32];
cout << theTime[i].descr << " is " << theTime[i].hour << ':'
<< theTime[i].minute << ":" << theTime[i].second << endl;
}
}