so I have 3 inputs a,b,c
ex 4, 7, 1
++++
+++++
++++++
+++++++
its supposed to look like this, it starts at 4 stars and keeps adding another star c times until it reaches 7
how would I code this Im very confused this is what I have so far
#include <iostream>
#include <iomanip>
int main(){
int r,a,b,c;
std::cin>> a;
std::cin>>b;
std::cin>>c;
for(int i = a; i <= b; i++) {
for(int j = 1; j <=i; j++){
std::cout << "*";
}
std::cout << "\n" ;
}
}
>Solution :
While a is smaller than b, print "*" a times, then increment by c (step) for next iteration.
int main(){
int a,b,c;
std::cin>> a;
std::cin>>b;
std::cin>>c;
while(a < b){
for (int i =0; i < a;i++){
cout << "*";
}
cout << endl;
a+=c;
}
return 0;
}