Question

Given two input integers for an arrow body and arrowhead (respectively), print a right-facing arrow. Ex:...

Given two input integers for an arrow body and arrowhead (respectively), print a right-facing arrow.

Ex: If the input is:

0 1

the output is:

     1
     11
00000111
000001111
00000111
     11
     1

#include
using namespace std;

int main() {
   int baseChar;
   int headChar;

   /* Type your code here. */

   return 0;
}

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

#include <iostream>

using namespace std;

int main() {
int baseChar;
int headChar;
  
cin >> baseChar >> headChar; // taking user input
  
cout << endl << " " << headChar << endl; // printing the arrow using given head and base
cout << " " << headChar << headChar << endl;
cout << baseChar << baseChar << baseChar << baseChar << baseChar << headChar << headChar << headChar << endl;
cout << baseChar << baseChar << baseChar << baseChar << baseChar << headChar << headChar << headChar << headChar << endl;
cout << baseChar << baseChar << baseChar << baseChar << baseChar << headChar << headChar << headChar << endl;
cout << " " << headChar << headChar << endl;
cout << " " << headChar << endl;
}

// Please up vote. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
Given two input integers for an arrow body and arrowhead (respectively), print a right-facing arrow. Ex:...
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
  • 1.13 LAB: Input and formatted output: Right-facing arrow Given two input integers for an arrowhead and...

    1.13 LAB: Input and formatted output: Right-facing arrow Given two input integers for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: 0 1 the output is: 1 11 00000111 000001111 00000111 11 1 Can anyone help me with this? I was able to get the smaller arrow on Chegg but not this one. Thank You!

  • Python Language Given input characters for an arrowhead and arrow body, print a right-facing arrow. Ex:...

    Python Language Given input characters for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: * # Then the output is: # ******## ******### ******## #

  • C++ please 27.5 Loops (nested)**: Sum a given number of integers A user will enter an...

    C++ please 27.5 Loops (nested)**: Sum a given number of integers A user will enter an initial number, followed by that number of integers. Output those integers' sum. Repeat until the initial number is O or negative. Ex: If the user enters 3 96 1 0, the output is 16 Ex: If the user enters 396125 3 0, the output is 16 Hints: Use a while loop as an outer loop. Get the user's initial number of ints before the...

  • C++ question Input Format You are given two strings, a and b, separated by a new...

    C++ question Input Format You are given two strings, a and b, separated by a new line. Each string will consist of lower case Latin characters ('a'-'z'). Output Format In the first line print two space-separated integers, representing the length of a and b respectively. In the second line print the string produced by concatenating a and b (a+b). In the third line print two strings separated by a space, a' and b'. a' and b' are the same as...

  • Write a program whose input is two integers and whose output is the two integers swapped....

    Write a program whose input is two integers and whose output is the two integers swapped. Write in C language 7.3 LAB: Swapping variables Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the output is: 83 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int* userVali, int* userVal2) ACRIVITY 7.3.1: LAB: Swapping variables 0/10 ] main.c...

  • 4.14 LAB: Convert to binary Write a program that takes in a positive integer as input,...

    4.14 LAB: Convert to binary Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. Ex: If the input is: 6 the output is:...

  • CC++ Compiler: CPP (gcc-5.x) 0 Simple Calculator Given two integers and a string, create a simple...

    CC++ Compiler: CPP (gcc-5.x) 0 Simple Calculator Given two integers and a string, create a simple calculator which performs the following operations: • Addition if the string is "+" • Difference if the string is "-" Multiplication if the string is "*" • Return quotient (obtained by dividing the first number by the second) if the string is "/" • Return greater value if the string is "max" • Return lesser value if the string is "min" solution.cpp 2 Create...

  • Fix the following code to print whether the input is positive or negative #include <iostream> #include...

    Fix the following code to print whether the input is positive or negative #include <iostream> #include <string> using namespace std; void positiveOrNegative(int); // declare function int main(){    int y; int result; cin >> y; result = positiveOrNegative(y);    return 0; } void positiveOrNegative(int x){ if (x>=0) cout << "Positive"; else cout << "Negative"; }

  • Loop Through String Loop through each character Print index number and Character on a line INPUT...

    Loop Through String Loop through each character Print index number and Character on a line INPUT 001 OUTPUT: Index 0: 0 Index 1: 0 Index 2: 1 #include <iostream> #include <string> using namespace std; The code I have so far: int main(){ string h; string i; cin >> i; for (i=0; i<h; i++){ if (h%i==0){ cout << i << endl; } } return 0; } Please help. Thank you.

  • Finish the following program which adds up all integers from 0 to the user's given number inclusively using a While Loop

    // Finish the following program which adds up all integers from 0 to// the user's given number inclusively using a While Loop. The total should be// assigned to the variable 'total'.#includeusing namespace std;int main() {int number;int total = 0;int counter = 0; //initialize the variable// user enters a numbercout << "Enter a positive integer to find the summation of ";cout << "all numbers from 0 to the given number up to 100." << endl;cin >> number;// check for invalid user...

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