Programming challenge/seatwork. Modify the program using the discussed sample program that will give the following output and use a function with parameter and no return type.
Use this to view the picture:
https://drive.google.com/file/d/1EG50edwQCKgXSWM8adkhe08w9gAWw2Sp/view?usp=sharing
Using function:
#include<iostream>
#include<string>
using namespace std;
void print(int number);
int main(){
int number=-1;
while(number<1 || number>10){
cout<<"Entre a number less than 10 ";
cin>>number;
}
print(number);
cin>>number;
return 0;
}
// output and use a function with parameter and no return type.
void print(int number){
cout<<"\n";
char character='a';
for(int i=1;i<=number;i++){
for(int j=0;j<i;j++){
cout<<character;
character++;
}
cout<<"\n";
}
}
Comments
Leave a comment