, , , , , , ,

[SOLVED] Cs4328 lab 1 1. write small c programs. a). the first program “pre.c”

$25

File Name: Cs4328_lab_1__1._write_small_c_programs.__a)._the_first_program_“pre.c”.zip
File Size: 706.5 KB

5/5 - (1 vote)

1. Write small c programs.a). The first program “pre.c”
should read in a list of student names and their GPAs. To be simple, you can just input the
students’ first names. Enter the inputs through the keyboard and display the outputs on the screen.
The inputs end when an EOF (generated by Ctrl-D) is encountered. The outputs of the program should
display the students whose GPAs are above 3.0.For example, the following are the inputs to “pre.c”.Susan 3.1
John 2.0
David 3.5
Jessica 3.4
Ctrl-D (press the keys to terminate the inputs.)then “pre.c” produces the output:
Susan
David
JessicaNote: an EOF is usually ‘sent’ to a process by hitting a CTRL_D.
If you type stty -a on your unix command line, you can get info that
tells you which keyboard keys mean what. FYI, in c, to put values to
standard_out use printf(). To get values from standard_in use scanf()
or getchar().b). The second program “sort.c” reads in a list of student names from the keyboard and
displays them in alphabetical order on the screen. Assume the sequence is read until
an EOF is encountered.If the inputs are:Susan
David
Jessica
Ctrl-D (press the keys to terminate the inputs.)The outputs should be:David
Jessica
Susan2. Write a c program to set up a child-TO-parent pipe; the child
should ‘exec’ to perform a “pre” process and its output should be
connected to the pipe connected to the parent, which should ‘exec’ to
perform a “sort” process.3. Write a program to take a UNIX command from the command line
and fork() a child to execute it. The command can be a simple
command like: $ls or $ps, Or it can be a command with options such as
$ls -t -l. Use argc and argv[] in the main function to pass parameters.
When the child process is executing the command, the parent process
simply waits for the termination of the child process. The process
id of the parent and the child should be printed out using getpid() and
getppid() functions.Submission:In order not to lose any files, you’d better zip all your files into a .zip file.Submit your project to TRACS before the deadline. Homework will NOT be accepted
through emails. You should write a readme textfile telling the grader how to run
your programs. Without this file, it is very likely that your project will not be
run properly.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cs4328 lab 1 1. write small c programs. a). the first program “pre.c”
$25