New to programming/first lang i decided upon is c++.
Alright alright, so i used something that was not given to me in the course so far.
which is “continue;” to complete the project.
but, it works! it really pissed me off because i never used the % module but let’s ignore that, it works - i think.
Also, i know it’s far-far away from ideal.
Please look at my code and tell me:
#include
#include <Windows.h> // By Neb, first programming lang / c++ (12-22-2018)
int main() {
for (int i = 1; i <= 100; i++) // main loop
{
Sleep(150);
if (i % 3 == 0 && i % 5 == 0) //If both fizz and buzz = true, it will say "Fizzbuzz" rather then create a new line which is not ideal
{
std::cout << "FizzBuzz!" << std::endl;
continue;
}
// fizz if statement
if (i % 3 == 0)
{
std::cout << "fizz" << std::endl;
Sleep(500);
}
// buzz if statement
if (i % 5 == 0)
{
std::cout << "buzz" << std::endl;
Sleep(500);
}
if (i % 3 == 0) // stops it from displaying the value of "i" if any of the above is true
continue;
else if (i % 5 == 0)
continue;
std::cout << i << std::endl;
Sleep(500);
}
system("pause");
}