This is a script I developed which asks for the users initial budget including their budget 1 & budget 2 then calculates the budget depending if the final value is greater or less than the budget.
#include <iostream>
using namespace std;
class Values {
public :
void start_(string Greet_){
cout << Greet_ << "\n";
};
void Add_ (){
int _bdg , val1_ , val2_, cho_; int count_ = 2;
//values of user input
cout << "Your budget: $"; cin >> _bdg;
cout << "Value 1: $"; cin >> val1_;
cout << "Value 2: $"; cin >> val2_;
if (val1_ + val2_ == 0 || val1_ + val2_ < 0 ){
cout << "Please Enter a valid amount";
}
if (val1_ + val2_ <= _bdg){
int remain_ = val1_ + val2_;
cout << "-----Your on Budget :)-----\n";
cout << "Your budget was: " << _bdg << "\n";
cout << val1_ << " + " << val2_ << " = " << _bdg << "\n";
cout << "You have $" << (_bdg-remain_) << " " << "remaining.";
} else {
cout << "---CAUTION: You're values exceeds budget limit :(---";
}
}
};
int main(
Values obj;
obj.start_("Budget Calculator ~ Nethan Nagendran");
obj.Add_();
}