Drawing Characters C++
(NOT ALLOW ARRAY AND STRING)
Problem Description
Annie is trying to draw character lines that she would like to use as decorations in her text messages to her friends. She has a list of integer and character pairs that she uses as basis for drawing out the lines. Write a program that will help her accomplish the task more quickly.
Input Format
The input begins with an integer N indicating the number of integer and character pairs that follows.
The succeeding lines are pairs of an integer T and a character C, where denotes how many characters should be printed to create the line. The T and C pairs are separated by a space. C could be any of the following characters: *, #, @
Output Format
For each T and C pair, print number of character/s with no spaces in between. Drawn lines for each pair must be in its own line in the output. If is not among the acceptable characters, print "Cannot draw!" without the quotation marks.
Constraint
1 <= N <= 100
1 <= T <= 100
C can be any of the following: *, #, @
Sample Input
3 5 * 10 @ 15 #
Sample Output
***** @@@@@@@@@@ ###############
Answer:
we can implement without using string and arrays as long as the user reads each character and its occurrences we can print them.we no need to store them.
#include<iostream>
using namespace std;
int main()
{
int n,t,i;
char c;
cout<<"Enter number of lines:";
cin>>n;
for(i=0;i<n;i++)
{
cin>>t>>c;
if((c=='*')||(c=='#')||(c=='@'))
{
for(int
j=0;j<t;j++)
{
cout<<c;
}
}
else
{
cout<<"Cannot draw!";
}
cout<<endl;
}
return 0;
}

output:

Drawing Characters C++ (NOT ALLOW ARRAY AND STRING) Problem Description Annie is trying to draw character...
Drawing Characters C++ Problem Description Annie is trying to draw character lines that she would like to use as decorations in her text messages to her friends. She has a list of integer and character pairs that she uses as basis for drawing out the lines. Write a program that will help her accomplish the task more quickly. Input Format The input begins with an integer N indicating the number of integer and character pairs that follows. The succeeding lines...
please I need help with the question:
Problem: Write a C++ program that reads each character
from a user input, extracts the character if it is a digit, and
calculates the sum of all the digits. The program stops reading the
user input when the new line character ‘\n’ is encountered. For the
output of the program, you should print each digit extracted from
the user input and the sum of all the digits.
(*The main difference between “cin >>...
(Packing Characters into an Integer) The left-shift operator can be used to pack four character values into a four-byte unsigned int variable. Write a program that inputs four characters from the keyboard and passes them to function packCharacters. To pack four characters into an unsigned int variable, assign the first character to the unsigned intvariable, shift the unsigned int variable left by 8 bit positions and combine the unsigned variable with the second character using the bitwise inclusive OR operator....
C++ please!
In this program you will be outputting the characters that map to the ASCIl codes 32 through 126. You will need a loop to iterate through the input values and output the corresponding character. This mapping is shown in appendix A in your Gaddis text book. Your program will be reading in two unsigned integer values. The prompt for read will be Enter lower and upper values You need to check that both values are in the range...
What’s the C++ code to this? So that my output is:
CCTAGAATG
| |
X | | X | |
GGACCTAAC
Validity: 77.7778%
Stability: 57.1429%
Part #02 The goal is to write a complete C++ program that inputs 2 strings from the keyboard, where each string denotes a DNA strand such as CCTAGAATG. Assume the 2 strings are the same length. The program will then CS 109: htp:/bwww.csic.edu i109 Page I of 3 line up the two strands to see...
//C++ Problem description In this problem, we consider expressions containing brackets that are properly nested. These expressions are obtained by juxtaposition of properly nested expressions in a pair of matching brackets, the left one an opening and the right one a closing bracket. ( a + $ ( b = ) ( a ) ) is properly nested ( a + $ ) b = ) ( a ( ) is not In this problem we have several pairs of...
This code is in Python: Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead. A snake is a pattern on a n by m table. Denote c-th cell of r-th row as (r, c). The tail of the snake is located at (1, 1), then it's body extends to (1, m), then goes down 2 rows to...
Hi, I need help writing a program that reads in data (hex, octal or decimal values) from an input file and outputs the values in to another base form (hex, octal,decimal) one line at a time depending on the formatting characters provided by the input file. I am posting the code requirements below and an example of what theinput file will look like and what should be output by the program. I only need the one .cpp program file. Thanks...
Write in C language . Thank you
Count Sheep Jojo is having problem to sleep at night. He can't fall asleep and it makes him feel tired every day. Having this problem, Jojo told his friend Bibi, and Bibi advised him to do sheep counting while he tries to sleep. Jojo decided to try using this trick for N nights, to test its effectiveness. Jojo realized that he would fall asleep if he imagined a total of 10 white sheep....
C++ programing question22
Minimum spanning tree
Time limit: 1 second
Problem Description
For a connected undirected graph G = (V, E), edge e corresponds to
a weight w, a minimum weight spaning tree can be found on the
graph.
Into trees.
Input file format
At the beginning, there will be a positive integer T, which means
that there will be T input data.
The first line of each input has two positive integers n,m,
representing n points and m edges...