I am self studying C++ and I was thinking of a simple program to get comfortable with the syntax.
int main(){
int num;
cout << "Enter a positive number:";
cin >> num;
printStar(num);
}
void printStar(int num){
.............................
}
Such that the function printStar accepts an integer and prints * for instance accepts 3 and prints *** or accepts 6 and prints ****** or accepts 2 and prints **. I was thinking of using a for or while loop and getting it done any better ideas suggestions?
Since this is for your own learning, i am not giving a solution, a hint is using For or While loop. If it works, its good, otherwise post your code and problem.
A link to get you started