Loops CPP
Loops CPP
* loops.cpp
*
* EECS 183
* Lab 4: Loops exercises
*/
#include "loops.h"
#include <iostream>
void printRight(int n) {
for(int i=1; i <= n; i++){
for(int j = 0; j < i; j++){
cout << "*";
}
cout << endl;
}
}
void printRightJustified(int n) {
for(int i=n-1; i >= 0; i--){
for(int j = 0; j < i; j++){
cout << " ";
}
for(int k = i; k < n; k++){
cout << "*";
}
cout << endl;
}
}
void printIsosceles(int n) {
int m = n;
for(int i = 0; i < n; i++){
for(int j = m; j > 1; j--){
cout << " ";
}
This study source was downloaded by 100000841455145 from CourseHero.com on 02-09-2022 16:21:55 GMT -06:00
https://www.coursehero.com/file/38187622/loopscpp/
Powered by TCPDF (www.tcpdf.org)