• Log in or sign up for an account here: https://www.sythe.org/login

Potion Decant Calculator

T7 Press 7T

Forum Addict
Joined
Jun 14, 2007
Sythe Gold
0
Messages
384
For whatever reason this morning I felt the need to use a potion decant calculator and couldn't find one so I made one. At the time I didn't know the formula:
Code:
potionAmount * .75 = fullPotions;
so I just made my own way to do it.

This one counts the empty and other filled vial types.

Screen:
decantlulz.png

Scan:
http://virusscan.jotti.org/en/scanresult/7334330a375375e356e24cde56933a2a79ac00ab
File:
http://www.sendspace.com/file/fzohe4

Code:
#include <iostream>

using namespace std;

int main() {

	int potAmount;
	int counter = 0;
	int pot4 = 0, pot3, pot2 = 0, pot1 = 0, pot0 = 0, currPot = 3;

	cout << "Please enter the total potion amount: ";
	cin >> potAmount;
	pot3 = potAmount;

	for ( int loop = 0; loop < potAmount; loop++ ) {
		switch (currPot) {
		case 3:
			currPot--;
			pot4++;
			pot3--;
			pot2++;
			break;
		case 2:
			currPot--;
			pot4++;
			pot2--;
			pot1++;
			break;
		case 1:
			currPot--;
			pot4++;
			pot1--;
			break;
		case 0:
			currPot = 3;
			pot0++;
			break;
		}
	}

	cout << "You have " << pot4 << " 4 dose potions." << endl;
	cout << "You have " << pot2 << " 2 dose potions." << endl;
	cout << "You have " << pot1 << " 1 dose potions." << endl;
	cout << "You have " << pot0 << " empty vials" << endl;

	system("pause");
	return 0;
}

I'm fully aware "system("pause");" is pretty lame, but Visual Studio isn't letting me pause any other way; even with simple "cin.get()".
 
I'm fully aware "system("pause");" is pretty lame, but Visual Studio isn't letting me pause any other way; even with simple "cin.get()".

Try flushing the cin buffer at the end.

Code:
cin.ignore(std::numeric_limits<std::streamsize>::max());
cin.get();
return 0;
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
+1 on using iostream, it's so painful when I see people using c functions like printf in C++
 
Runescape Gamblingrunescape gambling
Back
Top