0

Write code to prompt the user to input a character and a number. Then print out the character that number of times. This is one of many questions I must answer, but it will help me get started on my code.

4
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by totem mouse
0

You're not doing my HW by answering that question. I can get it to prompt me to enter a character and the number. But not how to print that character that many times.

0

You're not doing my HW by answering that question. I can get it to prompt me to enter a character and the number. But not how to print that character that many times.

Ok. Here is the code.

#include <iostream>
int main() {
   int i;
   int number=1;
   char charachter;

   cout<<"Please enter a charachter: ";cin<<charachter;
   cout<<"\nPlease enter a number:  "; cin<<number;
   for(i=0; i<number+1; ++i)
      cout<<charachter;
   return 0;
}
0

zhelih - please go back and fix your OBO error.

Or are you trying to give TechBoy a wrong homework answer?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.