This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:fall2023:projects:cnv0 [2023/09/22 19:08] – [Determining factor pairs] cmazzara | notes:cprog:fall2023:projects:cnv0 [2023/09/28 01:25] (current) – [Compiling] xcroft | ||
---|---|---|---|
Line 5: | Line 5: | ||
"main number" | "main number" | ||
=====Compiling===== | =====Compiling===== | ||
+ | Can do gcc cnv0 then it will pop out a.out then do ./a.out and your prompt should come out. | ||
+ | Can also use Make | ||
=====Loops===== | =====Loops===== | ||
====for() loops==== | ====for() loops==== | ||
+ | a for() loop has the format of for(start; loop condition; step){CODE HERE}. | ||
+ | An example would be for(factor = 1; conditions; factor = factor+1){CODE HERE}. This ensures that every time your condition is run the steps continue to progress until the conditions are not met anymore. | ||
====while() loops==== | ====while() loops==== | ||
+ | |||
+ | A " | ||
+ | |||
+ | number = 6 | ||
+ | factor = 1 | ||
+ | | ||
+ | while (factor <= number) | ||
+ | { | ||
+ | factor = factor + 1 | ||
+ | }; | ||
+ | | ||
+ | This means that the factor variable, in this example " | ||
+ | |||
+ | Recall, double and (&& | ||
====do-while loops==== | ====do-while loops==== | ||