diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..69151c361d787d30c3aeb0e81c7476c6c88a57ae --- /dev/null +++ b/main.cpp @@ -0,0 +1,84 @@ +#include <iostream> +#include <stdlib.h> +#include <stdio.h> + +using namespace std; + +int main() +{ + // Task 1 - Print greeting + printf("Hello World!\n\n"); + + // Task 2 - Print 10 times + int i = 0; + + for (i = 0; i < 11; i++) + { + + printf("Message loop!\n"); + + } + printf("\n\n"); + + // Task 3 - Name input + printf("INPUT NAME:\n"); + + string name; + + cin >> name; + + cout << "Hello " << name << "\n\n" << endl; + + // Task 4 - User input number of repeats + + int repeats = 0; + + while (repeats = 0); + { + printf("INPUT LOOP COUNT:\n"); + cin >> repeats; + + if (repeats > 0) + { + printf("INPUT SUCCESS! LOOP COUNT IS %d\n", repeats); + } + else + { + printf("SYNTAX ERROR! LOOP COUNT MUST BE INTEGER GREATER THAN 0!\n"); + } + } + + printf("\n\n"); + + // Task 5 - Fizz Buzz Test + + int x = 0; + + for (x = 0; x < 31; i++) + { + if (x % 3 == 0 && x % 5 == 0) + { + printf("FIZZ AND BUZZ! %d\n", x); + x++; + } + else if (x % 3 == 0) + { + printf("FIZZ! %d\n", x); + x++; + } + else if (x % 5 == 0) + { + printf("BUZZ! %d\n", x); + x++; + } + else + { + printf("%d\n", x); + x++; + } + } + + printf("WORKSHEET COMPLETE!\n\n"); + + return 0; +}