This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
notes:cprog:fall2023:projects:cnv0 [2023/09/10 20:35] – created wedge | notes:cprog:fall2023:projects:cnv0 [2023/09/28 01:25] (current) – [Compiling] xcroft | ||
---|---|---|---|
Line 3: | Line 3: | ||
====Determining factor pairs==== | ====Determining factor pairs==== | ||
+ | "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==== | ||