Question

Write the source codes in the command line interface that is named after your name to...

Write the source codes in the command line interface that is named after your name to generate the random code sequence like in the movie “Matrix”. Record the screenshot of your source code that includes all the required operations and results. You will get zero point if no screenshot is provided. [14 points]

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

Solution:

#include <iostream>

//The function returns remainder

int Modulo(int iN, int iM) {
int iQ = (iN/iM);
return iN- (iQ*iM);
}

//The function is to generate random characters in the assigned range of

char GenChar(int iG, char cB, int iR) {
return (cB+ Modulo(iG, iR));
}

int main() {
char cRow[80]; //The array is for keeping 80 characters in a row
int a= 7, b= 17, c= 13, d= 1; //random value assigned to initiate the generation

//The while loop runs infinite times to create the fall effect
while (true) {
int i = 0;


// the following loop generates random row of characters
while (i < 100) {
if (cRow[i] != ' ') {
cRow[i] = GenChar(a + i*i, 33, 30);
}
std::cout << cRow[i];
++i;
}

// Random function assigned for number to keep changing (can be changed as per the effect)
a= (a + 41);
b= (b+ 11);
c= (c+ 37);
d= (d+ 57);
cRow[Modulo(a, 100)] = '-';
cRow[Modulo(b, 100)] = ' ';
cRow[Modulo(c, 100)] = '-';
cRow[Modulo(d, 100)] = ' ';

// To create delay in the number of runs 250000 times (can be changed as per the fall effect)
i = 0;
while (i < 25000) {
GenChar(1, 1, 1);
++i;
}
}

return 0;
}

Add a comment
Know the answer?
Add Answer to:
Write the source codes in the command line interface that is named after your name to...
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
  • A) Write a command that will execute the file named main and report memory management errors...

    A) Write a command that will execute the file named main and report memory management errors (memory leaks) when the program has finished. B) Write a command that will generate an executable file named main from the C++14 source code file main.cpp that includes all available debugging information. After this command, write a second command to start the C++ debugger in text user interface.

  • Your task is to write a C++ program that consumes integer values as command line arguments...

    Your task is to write a C++ program that consumes integer values as command line arguments and returns the arithmetic mean of these values. To increase the flexibility of the program, there should be no set number of arguments. To overcome this, we will require the argument argv[1] to be the number of integers the user enters. For example, if the user wants to calculate the arithmetic mean of 4 numbers, they would pass in 4 as the first argument...

  • Problem: Write a program that behaves as described below.If the first command-line argument after the program...

    Problem: Write a program that behaves as described below.If the first command-line argument after the program name (argv[1]) is “--help”, print the usage information for the program. If that argument is not “--help”, you are to expectargv[1]and subsequent arguments to be real numbers(C, integer, float, or double types)in formats acceptable to the sscanf()function of the C library or strings of ASCII chars that are not readable as real numbers. You are to read the numbers, count them and calculate the...

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

  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

  • Write a C program, named sortit, that reads three integers from the command line argument and...

    Write a C program, named sortit, that reads three integers from the command line argument and returns the sorted list of the integers on the standard output screen, For instance, >sortit 3 5 7 >The sorted list is 3, 5, 7. >sortit 4 0 9 >The sorted list is 0, 4, 9 >sortit 1 p 9 >sortit: invalid input p. >sortit >usage: sortit num1 num2 num3! 1. The source code of a c file 2. Screenshots that show successful execution...

  • Help please Write a program named one.c that takes a single command-line argument, the name of...

    Help please Write a program named one.c that takes a single command-line argument, the name of a file. Your program should read all the strings (tokens) from this file and write all the strings that are potentially legal words (the string contains only upper-case and lower-case characters in any combination) to the file words. Your program should ignore everything else (do not write those strings anywhere 1. As an example, running /a.out dsia would result in the generation of the...

  • Write a Bash script called hello that uses command line arguments to allow the user to...

    Write a Bash script called hello that uses command line arguments to allow the user to put two strings after the command name, when the script is being executed. These strings should represent a first and last name. The script should then write out a greeting to the user that includes the first and last name. Here is an example of how the script might work (the first line represents what the user types to launch the script): [user@HAL] hello...

  • Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text...

    Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text file by removing all blank lines (including lines that only contain white spaces), all spaces/tabs before the beginning of the line, and all spaces/tabs at the end of the line. The file must be saved under a different name with all the lines numbered and a single blank line added at the end of the file. For example, if the input file is given...

  • Q4) Write a C program named "hw3q4.c” that takes three string inputs from the command line...

    Q4) Write a C program named "hw3q4.c” that takes three string inputs from the command line arguments that represent file names. The first and second files contain four sorted integer numbers that represent set elements. The main process creates a child process that shares the three files. The child process determines the intersection set of two sets and saves the line: "Child process PID: xxxx Intersection of (x, x, x, x) and (y, y, y, y) (z, z, z, z)"...

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