Professional Documents
Culture Documents
#include <iostream>
#include<string>
#include<math.h>
struct time
int h, m, s;
void setTime()
void showTime()
s -= 60;
m++;
m - +60;
h++;
h -= 24;
}
cout << h << ":" << m <<":" << s << ":" << endl;
void newTime()
h = h + nhour;
m = m + nmin;
s = s + nsec;
};
int main()
time t1;
t1.setTime();
t1.showTime();
t1.newTime();
t1.showTime();
system("pause");
return 0;
}
Q2
#include <iostream>
#include<string>
#include<math.h>
struct student
string name;
void getInfo()
getline(cin, name);
average += degree[i];
void display()
};
int main()
student s1;
s1.getInfo();
s1.display();
system("pause");
return 0;
}
Q3
#include<iostream>
struct library
float price;
};
cout << "Enter data of book number " << i + 1 << endl;
int max = 0;
max = i;
cout << "The data of most costly book is" << endl;
int main()
library b[1000];
int n;
cin >> n;
read(b, n);
display(b, n);
mostcost(b, n);
system("pause");
return 0;
}
Q4
#include<iostream>
struct dimension
};
struct result
};
struct rectangle
dimension d;
result s;
};
int main()
rectangle r[5];
cin>> r[i].d.length;
cout << "Area No." << i + 1 << "=" << r[i].s.area << endl;
cout << "perimeter No." << i + 1 << "=" << r[i].s.perimeter << endl;
system("pause");
return 0;