Question

1) Write a complete C or C++ program to print Hello World Greetings. 2) Using the...

1) Write a complete C or C++ program to print Hello World Greetings.

2) Using the command line, compile and generate the executable for the above program. Let’s call helloWorld the target executable.

3) Write a C program that does the following:

a) forks a child to execute helloWorld

b) waits for the child execution to end

4) Reuse the above program to try a different variant of exec family of system calls.

OPTIONAL:

1) write a program main that takes two operands, computes their sum, and prints the results. The 2 operands are given as arguments in the command line. A typical execution looks like:

./main 5 7

12

2) Using the command line, compile and generate the executable for the above program. Let’s call main the target executable.

3) Write a C program that does the following:

a) forks a child to execute main; recall that main takes two operands

b) waits for the child execution to end

4) Reuse the above program to try a different variant of exec family of system calls.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since you have posted multiple problems I shall solve only first two problems because first and second problem is interrelated.

1. Code

#include<stdio.h>

int main()
{
   printf("Hello World!!!\n");
}

2. Command line operations

Add a comment
Know the answer?
Add Answer to:
1) Write a complete C or C++ program to print Hello World Greetings. 2) Using the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C program called test that takes one command line argument, an integer N. When...

    Write a C program called test that takes one command line argument, an integer N. When we run test: ./test N the program will do this: the parent process forks N child processes each child process prints its process ID, exits the parent process waits for all child processes to exit, then exits

  • Using Unix processes Submit a README file that lists the files you have submitted along with...

    Using Unix processes Submit a README file that lists the files you have submitted along with a one sentence explanation. Call it Prj1README. MakeCopy.c : Write a C program that makes a new copy of an existing file using system calls for file manipulation. The names of the two files and copy block sizes are to be specified as command line arguments. Open the source file in read only mode and destination file in read/write mode. ForkCopy.c : Write a...

  • CSIT 345 Lab 2 Process Programming Your lab requirement is to write program codes for 3.21 and sh...

    *Help Please with the code** CSIT 345 Lab 2 Process Programming Your lab requirement is to write program codes for 3.21 and shared memory program for producer and consumer as shown in the following. You can start with the code provided in the virtual machine in the virtual box you installed. The code can be found in /home/oscreader/osc9e-src/ch3 a. For 3.21, you can start with the newprocposix.c and modify the code to meet your requirement. Then type: gcc neypCOCROSİS.c to...

  • Write a program in C using the fork() system call to do the following. The parent process (main program) forks a process...

    Write a program in C using the fork() system call to do the following. The parent process (main program) forks a process (CHILD 1) to compute and print the sum of first n integers where n is a variable shared between the parent and CHILD 1. It also forks another process (CHILD 2) that finds the sum of squares of the first n numbers where n is a variable it shares with the parent. Let CHILD 1 print “The sum...

  • Using Unix processes Submit a README file that lists the files you have submitted along with...

    Using Unix processes Submit a README file that lists the files you have submitted along with a one sentence explanation. Call it Prj1README. MakeCopy.c : Write a C program that makes a new copy of an existing file using system calls for file manipulation. The names of the two files and copy block sizes are to be specified as command line arguments. Open the source file in read only mode and destination file in read/write mode. ForkCopy.c : Write a...

  • You are required to write a C program on Unix/Linux in which the parent process creates...

    You are required to write a C program on Unix/Linux in which the parent process creates three child processes, lets them run concurrently, and waits for them to return and prints their exit status. The three child processes are assigned different tasks. Child one is to calculate and display the highest mark of a class of ten students for a unit. Child one is required to get the marks from the standard input (i.e. the keyboard). Child two is to...

  • Edit the code (shell.c) given to do the tasks asked! will rate for correct answer! Also,...

    Edit the code (shell.c) given to do the tasks asked! will rate for correct answer! Also, include a screen shot of the output and terminal window of each command you used. Read carefully to do this task please. shell.c code given below. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/wait.h> #include <string.h> int main() { int PID; char lineGot[256]; char *cmd; while (1){ printf("cmd: "); fgets(lineGot, 256, stdin); // Get a string from user (includes \n) cmd = strtok(lineGot, "\n");...

  • Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and...

    Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and circle.h             2) Create a new directory to store the files in             3) Compile the code a) Run the command g++ driver.cpp -o executable_name, this will compile the code both for driver.cpp and the referenced file circle.h note: -o parameter specifies a new name for the executable, if you do not specify the “-o” parameter the default name of the executable is “a.out”...

  • C program To develop a C program to implement a process system call. PROBLEM You are...

    C program To develop a C program to implement a process system call. PROBLEM You are to use the Ubuntu operating system to write a C program that creates a process to determine the identification of the current user of your computer. I mean if joe is the login of the current user of your computer your solution should return joe. Your solution must also provide the pid of both the parent and the child processes. You may use the...

  • ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will...

    ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will output to the screen any character data pointed to by the EDX register. It will continue to print until it runs into the null character (zero). We need only to move the address into the EDX register and calll his routine. Lookup in the ASCII code chart the value reqresented by CR and LF. In the program I will define these values using the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT