1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
emmainna [20.7K]
4 years ago
5

Write a program that asks the user to input some letters to be vertically displayed. Put a zero at the end to signify the end of

the letters to be printed much like the '#' in HW2B). You should skip white space, such as tabs, spaces or enters (see example 2). You should then print the input text vertically on the 10 character index 9 or in the middle) of each row, and the rest of the row should be filled with a random character chosen from {'0', '1','' or (space)}. There should be a total of 19 characters on each line (including the actual words, so it is in the center). You may assume they user always puts a zero at the end of their desired text. I suggest you break this program up into various parts (i.e. functions).
Computers and Technology
1 answer:
IRINA_888 [86]4 years ago
7 0

Answer:

C++ code is explained below

Explanation:

sequence.cpp

#include<iostream>

#include<cstdlib>

#include<ctime>

using namespace std;

char randomChar(){

   char arr[4] = {'0','1','.',' '};

   int index = rand()%4;

   return arr[index];

}

void printLine(char c, int spot, int len){

   for(int i=0;i<len;i++)

       cout<<randomChar();

   cout<<c;

   for(int i=0;i<len;i++){

       cout<<randomChar();

   }

   cout<<endl;

}

int main(){

   cout<<"What do you want printed vertically?"<<endl;

   string seq;

   getline(cin,seq);

   srand(time(NULL));

   char cleanedSeq[10000]; // to store sequence without spaces or tabs

   int i=0,k=0;

   while(seq[i]!='\0'){

       if(seq[i]!=' ' && seq[i]!='\t' && seq[i]!='\n'){

           cleanedSeq[k++]=seq[i];

       }

       i+=1;

   }

   cleanedSeq[k]='\0';

   for(int i=0;cleanedSeq[i]!='\0';i++){

       printLine(cleanedSeq[i],9,9);

       if(cleanedSeq[i]=='0') //if we encounter any zero we stop printing

           break;

   }

   return 0;

}

You might be interested in
Which software program is used to create a database on a computer, add, change, and delete data in the database, and create quer
Radda [10]
I'd say Microsoft access
3 0
3 years ago
Read 2 more answers
A Venn diagram is used to show can somebody help plz
djyliett [7]
A venn diagram is used to show the similarities and the differences  <span />
3 0
4 years ago
Read 2 more answers
Two technicians are discussing shielded cable. Technician A says that shielded wires are generally twisted in pairs to cancel th
Black_prince [1.1K]

Technician A is Correct. So this is actually a question I just had come up in my IT-140 Networking Fundamentals class but as a matter of fact I also know this because I've worked as a Network Technician for many years now both as a salaried employee and as an Independent Contractor. The reason Technician A is correct is because, indeed Wires in a Shielded Twisted-Pair (STP) cable or even Unshielded Twisted-Pair (UTP) cable are intentionally made this way for two reasons: the expressed purpose of actually twisting the wires in the first place is to protect them from interference called "EMI" (as stated in the question, Electromagnetic Interference!), however they are also twisted this way because of a similar interference (and in most cases, classified as the same kind of disturbance) called RFI or Radio Frequency Interference. As a technician, one of my jobs was hanging Access points in ceilings, and a requirement of that particular job was to make sure that these cables (which in this case were Cat6 which is short for Category 6, the exact cable that is referred to in the question, because Category 6 cable is shielded) were not to be left laying on the ceiling tiles in the drop ceilings! The reason being is, the light fixtures have electricity running through them, and anything with electricity running to it gives off Electromagnetic Interference. So, again Technician A is correct but... I have to say this as a side note... it would be <em>completely</em> pointless and utterly time consuming to remove these cables and replace them with a straight wire <u>just</u> because the warranty expired on a vehicle. Besides... Straight Though Wire and Twisted Pair are used for two completely different things.

Hope this helps! If you'd like to fact check me, google "emi interference"

CJ

3 0
4 years ago
What helps determine the style and tone of a blog?
Paul [167]

The correct answer is A.  The style and tone of the blog is dictated by the target audience.  For example, a blog about types of coffee will be much more informal than a blog about business practices.  The information conveyed on these platforms set the tone and style.

8 0
4 years ago
Read 2 more answers
A motherboard uses dual channeling, but you have four DIMMs available that differ in size. The motherboard supports all four siz
Andru [333]

Answer:

Explanation:

We can install four DIMMs with different size, for example if we want 1 GB, 2 GB, 4 GB, and 8 GB, in this example every DIMM are different, but we can install these DIMMs in our motherboard, but the dual channeling, in this case is not enabled, because DIMMs must be with the same size, frequency, latency, and even model, and nowadys there is quad channeling.

7 0
4 years ago
Other questions:
  • John wants to access specific programs from the Start menu in his laptop. However, he is unable to view them when he clicks the
    14·2 answers
  • Which of the following is a type of monitor port?
    10·1 answer
  • True or False: if there are multiple operations inside a parentheses, you do not need to complete theses in the order of pemdas​
    12·1 answer
  • Create a program that will read in a Salesperson name, employment status (1=Full-time AND 2=Part-time) and the sales amount.
    5·1 answer
  • Create a structure representing a student. The member variables should include student name, student ID, and four test grades fo
    12·1 answer
  • After you have figured out your storyline, what should be the next thing to
    5·2 answers
  • What is the main advantage of using a WYSIWYG("what you see is what you get")editor when constructing a website
    5·1 answer
  • Where do animators work?
    6·1 answer
  • Difference between the four generations of computers in a tabular form​
    8·1 answer
  • A programmer is creating an algorithm that will be used to turn on the motor to open the gate in a parking garage. The specifica
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!