diff options
| -rw-r--r-- | CST116F2021-Lab3/CST116F2021-Lab3.cpp | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/CST116F2021-Lab3/CST116F2021-Lab3.cpp b/CST116F2021-Lab3/CST116F2021-Lab3.cpp index 7db63d6..61ab7aa 100644 --- a/CST116F2021-Lab3/CST116F2021-Lab3.cpp +++ b/CST116F2021-Lab3/CST116F2021-Lab3.cpp @@ -7,29 +7,50 @@ using namespace std; int main() { - //p.184 - - int length = 0; - int height = 1; - - cout << "Please input the base length of your triangle: "; - cin >> length; - - height = length; - do { - do - { - cout << '*'; - length = length--; - } while (length != 0); - cout << "\n"; - height = height--; - length = height; - } while (height != 0); + //p.192 + + int input = 0, seq1 = 0, seq2 = 0; + + + cout << "Please enter your ending number: "; + cin >> input; + + do + { + if (seq1 == 0) + seq1 = seq1++; + + seq2 = seq1 + seq2; + } while (seq1 <= input || seq2 <= input); return 0; + + + ////p.184 + + //int length = 0; + //int height = 1; + + //cout << "Please input the base length of your triangle: "; + //cin >> length; + + //height = length; + //do { + // do + // { + // cout << '*'; + // length = length--; + // } while (length != 0); + // cout << "\n"; + // height = height--; + // length = height; + //} while (height != 0); + + //return 0; + + //p.179 /*int input = 0; |