Program in c to generate random input - python script, Python Programming

Assignment Help:

For this assignment, you are to:

1.    Modify the output format of your Python script from Assignment 1 to match the input format of your C program from Assignment 2.

2.    Write a program in C to generate random input for your Python script.

3.    Write a driver program in C that, using Inter-Process Communication (IPC), links the output of the random input generator to the input of the Python script, and the output of the Python script to the input of the C program from Assignment 2.

Resource

The online book, \Advanced Linux Programming," will be useful for this assignment and beyond.

Sample Run

You should name the driver's executable a3750T26. In the following, we assume that \$" is the shell command-prompt.

$ make clean

$ make

$ chmod u+x ./a1750T26.py

$ ./a3750T26 -s 5 -n 4 -l 5

V = 8

E = f<0,2>,<0,3>,<0,4>,<1,3>,<4,7>,<5,2>,<5,6>g

s 2 4

2-0-4

In the above, the first four lines make your executable, ensure your Python script is executable, and run the driver program with some command-line arguments. Then, the lines \V = . . . ," \E = . . . ," and \2-0-4" are output. The input the user provided to your program via stdin is \s 2 4."

Input, Output and Error

Your program should take input from stdin, and output to stdout. Errors should be output to stderr. Errors should always start with \Error:" followed by a brief description. All your processes should terminate gracefully (and quietly) once you see EOF at stdin. Your program should not generate any extraneous output; for example, do not print out prompt strings such as \please enter input" and things like that.

As the example above indicates, there are two kinds of inputs the user provides. One is via the command-line arguments -s and -n. This is done once only, when your program is run. The other is the \s" input at stdin, which may be issued repeatedly, just as in Assignment 2. Your program should output a shortest path.

We will not test your program for format errors in the input. That is, the command-line arguments, if specified, will be formatted correctly, and the s input will also be formatted correctly. Of course, we may omit one or both command-line arguments (see below for what to do in such cases), and specify vertex IDs to s that do not exist, or between whom a path does not exist. The latter two  cases should cause your program to report an error.


Related Discussions:- Program in c to generate random input - python script

Question, Data array A has data series from 1,000,000 to 1 with step size 1...

Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.

Python-models, Models It is a new system that is considerably easier th...

Models It is a new system that is considerably easier than  the system being modelled, but which saves the important points of the original machine. We might create a physical

Normalize a vector, Normalize a vector Let's imagine we want  to norma...

Normalize a vector Let's imagine we want  to normalize a vector  of three  variables;  that  is to compute a new  vector  of three values,  such that its size  is 1. Here is o

Python program, Write a program that asks the user to enter a number of sec...

Write a program that asks the user to enter a number of seconds. The responses of the program will vary depending on the length of seconds: • If the number of seconds is under 60

Environments in python, Environments in Python Generally, Python estab...

Environments in Python Generally, Python establishes the following binding environments: 1.  builtin     : the mother of all environments: it contains the de?nitions of

assignment 10, #question.Program 10 Assignment (Banking Objects – Savings/...

#question.Program 10 Assignment (Banking Objects – Savings/Checking Accounts) Create a program named 10.py that performs the following: Create a class named ChkAcct, and a class n

Internal models, Internal models As we want to create  more and more c...

Internal models As we want to create  more and more complex  machine with  software programs as controllers, we search  that  it is often needful  to create  additional types

Coding examples of python, Coding examples Following are some  attempts...

Coding examples Following are some  attempts at defining a function isSubset,  which  takes  two  arguments, a and  b, and  returns True if a is a subset  of b, assuming that

Character stuffing.., write code for python characters stuffing program sou...

write code for python characters stuffing program source code

Variables, Variables We cannot  go very far without variables. A variabl...

Variables We cannot  go very far without variables. A variable is a value related to a name that we can bind  to have a particular value  and  then  later use in an expression.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd