My game so far!

#include

int main()

{

std::cout << "You are SpongeBob. Plankton is about to win his legal case against Mr. Krabs!";

std::cout << std:: endl;

std::cout << "The only thing that can save him is whatever is in the lawyer's breifcase.";

std::cout << std:: endl;

std::cout << "Find the combination and save the Krabby Patty Formula!" << std::endl;

//these are numbers

int CodeA = 4;

int CodeB = 12;

int CodeC = 8;

int CodeSum = CodeA + CodeB + CodeC;

int CodeProduct = CodeA * CodeB * CodeC;

std::cout << std:: endl;

std::cout << "There are 3 numbers in the code" << std::endl;

std::cout << "The code adds up to: " << CodeSum << std:: endl;

std::cout << "The numbers multiply to give : " << CodeProduct << std::endl;

int GuessA, GuessB, GuessC;

std::cin >> GuessA;

std::cin >> GuessB;

std::cin >> GuessC;

int GuessSum = GuessA + GuessB + GuessC;

int GuessProduct = GuessA * GuessB * GuessC;

if(GuessSum == CodeSum && GuessProduct == CodeProduct){

    std::cout << "You win";

}

else {

    std::cout << "Oh no! The case is still locked! Plankton has the Krabby Patty formula!";

}

return 0;

}

1 Like

The number one priority is to save the formula! :sunglasses:

Privacy & Terms