聯系方式

您當前位置:首頁 >> C/C++編程C/C++編程

日期:2019-06-03 11:10

Algorithms and C language

Homework 2

To be returned by Monday 10 June 2019

- You should send the source file and the executable file.

- Please, do not forget: your name, surname, your Tianjin code and UQAC code, as

well as your e-mail address if you have one.

- At most two names can appear on your homework copy.

Write a C program that does the following tasks each of which should be written as a

function:

1. Create a file FP that contains a set of persons structured each in a name of at most 30

characters and an integer to denote the age of that person.

2. Create a linked list from file FP in which each node has the following structure

struct node {

char name[20];

int age;

struct node *ptrnext;

}

3. Print on screen all the elements of the list each on a single line.

4. Delete all the occurrences to make the linked list contain only distinct names.

5. Print on screen all the elements of the list each on a line

6. Input from the keyboard a set of elements such that:

- If the new element already exists in the list, then insert it into the end of

the list.

- It the new element does not exist in the list, then insert it into the position

just before the element with the nearest age from below.

7. Print on screen all the elements of the resulted list each on a single line.

8. Print all the elements of the resulted list into file FP.

9. In the end of your program, destroy your linked list.


版權所有:編程輔導網 2018 All Rights Reserved 聯系方式:QQ:99515681 電子信箱:[email protected]
免責聲明:本站部分內容從網絡整理而來,只供參考!如有版權問題可聯系本站刪除。

25选5一等奖多少钱