-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhellofunc1.cpp
More file actions
37 lines (35 loc) · 812 Bytes
/
hellofunc1.cpp
File metadata and controls
37 lines (35 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// File: Hello/hellofunc1.cpp
// Author: Mihaela Malita
// Date: 06/02/2004
/* Title: Draw line ask how many times
RUN:
Draw line. how many stars? 14
**************
Continue(y/n)?=y
Draw line. how many stars? 1
*
Continue(y/n)?=n
************************************************/
#include <iostream>
using namespace std;
void line(int n);
/////////////////////////////////////////////////
int main() {
int N;
char ans ='y';
while ( ( ans == 'y') || (ans =='Y') ) {
cout << "draw line. how many stars? ";
cin >> N;
line(N);
cout << "\nContinue(y/n)?=" ;
cin >> ans;
}
return 0;
}
////////////////////////////////////////////////
void line(int n) {
for (int i=0; i < n ; i++) {
cout << '*';
}
cout << endl;
}