So, I started learning C++ last night and thought I'd mess around with a bit of basic stuff and see how far I could get on my own. It's a pretty simple program that's straightforward to see what it does if you look at the code:
NOTE: Yeah, I know it's a pretty lame thing to make a program about, but it's my first one. :P
Code:
#include <iostream>
using namespace std;
int main()
{
int DP_Left;
int DP_Fridge;
cout<<"How many cans of Dr Pepper do we have? ";
cin>> DP_Left;
if ( DP_Left <= 3 ) {
cout<<"We need more Dr Pepper!\n";
}
else if ( DP_Left <= 6 ) {
cout<<"We're running out of Dr Pepper!\n";
}
else if ( DP_Left >= 12 && DP_Left <= 24 ) {
cout<<"We have plenty of Dr Pepper!\n";
}
else if ( DP_Left > 24 && DP_Left < 50 ) {
cout<<"We have a ton of Dr Pepper!\n";
}
else {
cout<<"We have too much Dr Pepper! Share it with the others who love it!\n";
}
//Next Question
if ( DP_Left >= 12 ) {
cin.ignore();
do
{
cout<<"How many Dr Pepper are there in the refrigerator?";
cin>> DP_Fridge;
cout<<"Put more Dr Pepper in the refrigerator!\n";
DP_Fridge++; Dr Pepper in the
cout<< endl;and asks again.
} while ( DP_Fridge < 6 );
}
else {
cin.get();
}
}
Now what I'm trying to get it to do is if there are more than 6 Dr Pepper if the refrigerator, to print something like "There are plenty of dr pepper in the fridge." without adding to the 'DP_Fridge' integer. Obviously any constructive criticism would be greatly appreciated whether it's about my problem or any other part of my code.
Thanks in advance!