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

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.


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 ./

$ ./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


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.

Posted Date: 3/4/2013 6:41:04 AM | Location : United States

Related Discussions:- Program in c to generate random input - python script, Assignment Help, Ask Question on Program in c to generate random input - python script, Get Answer, Expert's Help, Program in c to generate random input - python script Discussions

Write discussion on Program in c to generate random input - python script
Your posts are moderated
Related Questions
from urllib2 import urlopen # Open for reading on line 4! response = body = response[559:1000] # Add your ''print'' statement here!

List mutation and shared structure Lists are mutable data  structures, which defines  that  we can actually modifies  the values  stored in their components. We do this by usi

Import the sample code below into the Python IDLE and enhance it, run it and debug it. Add features to make this a more realistic database tool by providing for easy data entry an

De?nition   A method de?nition has the abstract form: def ( , ..., ): ...   There are essentially three parts: is a name for

Java programs are  what  is known as statically and  strongly defined.  Thus,  the  kinds  of all the variables must  be known at the time that the program is written. That seems

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

Your task is to construct a translator from the subset of Python in Project 3 intocontinuation-passing style (CPS). Of course, the expected way of accomplishing this is to trans

Programs and Data Object-oriented programming is a popular way  of managing programs, which  groups together data  with  the procedures that  works on them,  thus  facilitatin

Procedures in python Procedures are computer program creates that let us capture common patterns of computation by: Grouping together sequences of statements

Basics of python-introduction Python is designed for easy interaction between a user and the system. It goes with  an inter­ active function  known as  a shell or listener.  T