《C语言外语ppt课件》由会员分享,可在线阅读,更多相关《C语言外语ppt课件(34页珍藏版)》请在金锄头文库上搜索。
1、 Lab Programming Syllabus High-level Language Programming I Chunhua Pan Chunhua PanLab Schedule and PolicyEvery Wednesday or by appointment;Totally 24 hours, 2 hours per week;Please be sure to get in the lab on time;Assignment will be shown in the class on the morning of the same day;Some assignment
2、s will be graded;It is a good habit to write the program on paper prior the lab time; Please write your program carefully and independently.Programming EnvironmentAssignment #1Write a program to show the following sentences:I am a student.I love China.Assignment #1Write a program to show the followi
3、ng figure:Assignment #1Given the values of three variables a = 2, b = 4, c = 7, write a program to calculate the sum of a, b and c;compute and output the value of variable x, where x = a / (b c)The result should be like the figure shown below:Assignment #2Write a program to get the values of integer
4、 a and b from the keyboard, and then calculate the results of a + b, a b, a * b, a / b and a % b respectively. Assignment #2Input the bottom length and height of a triangle, output the area of this triangle (Reserve two effective digits).Assignment #2Input five integers from the keyboard, and then o
5、utput the minimum number among them.Assignment #3Input n from keyboard, and calculate n!Assignment #3Print the first 20 Fibonacci Numbers.Assignment #3Print all the “Daffodils Number between 100 999.Assignment #3Input several numbers from keyboard, print the max number among them.Assignment #4Write
6、a function to return the maximum number in five numbers, you can use the function getMax(int a, int b, int c) two times.Assignment #4Write a program to accept two numbers from the keyboard, and then print the greatest common divisor (最大公约数) and the least common multiple (最小公倍数) using functions. Assi
7、gnment #4Calculate 1 + 2 + + n using nested calls of functions.Assignment #4Calculate 1 + 2 + + n using recursive calls of functions.Assignment #5Input several numbers, and output its reverse.Assignment #5Input a string, output the number of words it contains.Assignment #5Write a program to accept a
8、 string and a character, and then delete each element which is equal to the character from the array.Assignment #5Write a program to implement the following questions:Define a function void input(int s, int n) to get ten integers into an array;Define a function void sort(int s, int n) to sort these
9、integers in the array;Define a function void print(int s, int n) to output the sorted numbers in the array;Finally, write appropriate main function to test your program.Assignment #6Use the arrays of structures to store five students information including id, name and score, input the information fr
10、om the keyboard, output the information of the student with the maximum score, then sort these students by scores from low to high, finally, output information of these students.Assignment #6Write a function void decrement(int* a) to decrease the value of the argument in the main function by 1. You
11、should use pointer as parameter to the function decrementAssignment #7Write a function void decrement(int* a) to decrease the value of the argument in the main function by 1. You should use pointer as parameter to the function decrement.Similarly, write a function swap to exchange the values of two
12、variables outside the functionAssignment #7Input n from the keyboardInput n numbers from the keyboard and store them to a dynamically allocated arraySort these numbers using any of the sorting algorithmsOutput the sorted numbers to the screenFinally, output these sorted numbers to a file named “outp
13、ut.txtAssignment #8Input n from the keyboardInput n students data from the keyboard and store them to a dynamically allocated array of structuresOutput the student that has the maximum grade to the screenSort these students data by score from low to highFinally, output these data to a file named “ou
14、tput.txtAssignment #9Write a program to implement the following questions.Input the size for the first array;Input the size for the second array;Input the numbers for the first and the second array;Output he numbers which the first array has but the second array does not have;Output the numbers whic
15、h the second array has but the first array does not have;Output the common elements of the two arrays;Assignment #9Assignment #10Write a program to implement the address book using dynamic singly linked list, the node should contain name, address and phone#: Write a function create to store three pe
16、oples information into the singly linked list;Write a function print to print these information to the standard output;Write a function search to find the telephone number of a contact input by name.Assignment #10Assignment #11Define a dynamic singly linked list to store staffs information including
17、 id, name and salary. Please note that all the information should be input from the keyboard.Implement a function creat() to return the head pointer of the linked list;Implement a function named insert() to insert a staff into the linked list with the id from low to high;Implement a function named d
18、elete() to delete a staff with id n from the linked list;Implement a function named print() to print all the staff in the linked list to the standard output screen;Implement a function named printToFile() to print all the staff in the linked list to a file.Assignment #12Define a book search card str
19、ucture including book_name, author, publish_date, register_num and price. Input all the member variables of the structure and then output.Use the arrays of structures to store five students information including id, name and score, input the information from the keyboard, then output the average score of the students.Next AssignmentNoneThank you!