From 5a14fae64e0d1f9be0880ef7eebb116af0b96cbf Mon Sep 17 00:00:00 2001 From: WiserJ Date: Tue, 19 Oct 2021 15:52:37 -0700 Subject: p.192a --- CST116F2021-Lab3/CST116F2021-Lab3.cpp | 59 ++++++++++++++++++++++++----------- 1 file 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; -- cgit v1.2.3