# UESTC 1005课程代写、Programming编程代做

 UESTC 1005课程代写、Programming编程代做 UESTC 1005 – Introductory Programming Page 1 of 2 Lab Session - Pointers Exercise 1: Pointers Background Pointers: stuff from lecture notes. To keep track of time, computers need something to measure it against. In C on the lab computers, we get the number of seconds since 00:00:00 UTC on 1 January 1970. As you might imagine, this produces a fairly large number -- it exceeds the bounds of a normal int. We therefore use a long int, which has twice the number of bits of a normal int. Our time.h library also defines a special data type to store the time value: time_t. On our computers, this is the same as a long int. Technical details Swapping data with pointers: #include void swap(int *px, int *py) {  int temp = *px;  *px = *py;  *py = temp; } int main() {  int x = 1;  int y = 2;  printf("initial: %i %i\n", x, y);  swap( &x, &y);  printf("Swapped: %i %i\n", x, y);  getchar();  return 0; } Watch out   For the * and & Getting the time: #include #include // extra include int main() {  time_t now;  now = time(NULL);  long int a = now;  printf("%li\n", now); } UESTC 1005 – Introductory Programming Page 2 of 2  Getchar(); Return 0; } Your task... Calling time(NULL) gives you a large integer. Use this value to calculate today's year, date, hours, and minutes. • Simplifying assumption: we pretend that each year has exactly 365 days. The 15th of March is therefore day 83 in year 2011. (use that date to figure out today's "day number") (hint: how many seconds are there in a day?) • You cannot use struct for this assignment. • You Cannot use any time-based functions from the standard library such asasctime or strftime. • You must use one function to calculate the year and day (pass in the total seconds, and a reference to the year and day). • You must use a separate function to calculate the hours and minutes. (again, pass the total seconds, and a reference to the hours and minutes) • You must Use a separate function to print the time; this function can only take as arguments the year, day, hour, and minutes. (optional: handle leap-years correctly, and print the month as well) Note: Show your work to a demonstrator/GTA.   如有需要，请加QQ：99515681 或邮箱：99515681@qq.com 微信：codehelp
免责声明：珠穆朗玛网对于有关本网站的任何内容、信息或广告，不声明或保证其正确性或可靠性，用户自行承担使用网站信息发布内容的真假风险。