CUerMAC-PRonDeitopleowhilecpp-De-C-540 Hle a Search View Praject Eecute Debug eos CS Wiedow Hp ala Project cD dauhilespp 1 #include 2 #include 3 4 |/ ask user how many special characters they want printed in a line 5 // read the character they typed 6 // using a while loop 8 using namespace std; 10 int main () 11e { 12 char a; // a special character like an asterisk 13 int n; // how many to be printed in a line 14 15 cout<<"please enter a special character"<>a; 17 cout<<"how many times should this char be printed on a line?"<>n; 19 20 while (n>0) 21 (cout<

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 8PP: (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays...
icon
Related questions
Question

rewrite using a for loop

CUerMAC-PRonDeitopleowhilecpp-De-C-540
Hle a Search View Praject Eecute Debug eos CS Wiedow Hp
ala
Project cD dauhilespp
1 #include <iostream>
2 #include <cmath>
3
4 |/ ask user how many special characters they want printed in a line
5 // read the character they typed
6 // using a while loop
8 using namespace std;
10 int main ()
11e {
12 char a; // a special character like an asterisk
13 int n; // how many to be printed in a line
14
15 cout<<"please enter a special character"<<endl;
16 cin>>a;
17 cout<<"how many times should this char be printed on a line?"<<endl;
18 cin>>n;
19
20 while (n>0)
21 (cout<<a;
22 n--;
23 }
24
25 return 0;
26
27}
Transcribed Image Text:CUerMAC-PRonDeitopleowhilecpp-De-C-540 Hle a Search View Praject Eecute Debug eos CS Wiedow Hp ala Project cD dauhilespp 1 #include <iostream> 2 #include <cmath> 3 4 |/ ask user how many special characters they want printed in a line 5 // read the character they typed 6 // using a while loop 8 using namespace std; 10 int main () 11e { 12 char a; // a special character like an asterisk 13 int n; // how many to be printed in a line 14 15 cout<<"please enter a special character"<<endl; 16 cin>>a; 17 cout<<"how many times should this char be printed on a line?"<<endl; 18 cin>>n; 19 20 while (n>0) 21 (cout<<a; 22 n--; 23 } 24 25 return 0; 26 27}
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT