No matter what letter I input, it gives me the first option, I’m looking for the error but im new, 3 days learning so far, so i honestly dont see it, idk what im doing wrong, but i would like it to give the correct info depending on the letter input, thx in advance, the code its not done yet, i’m doing it while doing an online course, so im brand new on this, (NONE OF THE CODE IS ON THE COURSE ITSELF, MADE BY ME, LINE BY LINE) so thats why it sucks, if u have any tips, or just wanna joke on me, go ahead, i want to learn and that would help, in case anyone wants to know what course im doing is this one (https://www.w3schools.com/CPP/cpp_functions.asp) thats what i have read so far
Theres the code, thx guys (yeah, McAfee the antivirus cause im working at a cc where he’s the client so i used as example to practice)
#include <iostream>
#include <string>
using namespace std;
struct Pack {
double Price;
char Package;
};
int main() {
Pack Basic;
Basic.Price = 29.99;
Basic.Package = 'A';
Pack Essential;
Essential.Price = 39.99;
Essential.Package = 'B';
Pack Premium;
Premium.Price = 49.99;
Premium.Package = 'C';
Pack Advance;
Advance.Price = 89.99;
Advance.Package = 'D';
Pack Ultimate;
Ultimate.Price = 199.99;
Ultimate.Package = 'E';
Pack PremiumFam;
PremiumFam.Price = 69.99;
PremiumFam.Package = 'F';
Pack AdvanceFam;
AdvanceFam.Price = 89.99;
AdvanceFam.Package = 'G';
Pack UltimateFam;
UltimateFam.Price = 249.99;
UltimateFam.Package = 'H';
cout << "McAfee Package refund % Multiplier" "nn";
cout<< "This program will allow you to get the refund % of any packages" "n" "Please see Packages below: " "nn";
cout<< "A- Basic $29.99" "n" "B- Essential $39.99 " "nn";
cout<< "C- Premium: $49.99" "n" "D- Advance (Individual) $89.99" "n" "E- Ultimate (Individual) $199.99" "nn";
cout<< "F- Premium (Family) $69.99" "n" "G- Advance (Family) $69.99" "n" "H- Ultimate (Family) $249.99" "nn";
char Intro;
cout<< "Please select the package by letter assigned: " "n";
cin>> Intro;
if (Intro = Basic.Package) {
cout<< "The Package selected is: " << "Basic" << "t" << "At a cost of: $" << Basic.Price;
} else if (Intro = Essential.Package) {
cout<< "The Package selected is: " << "Essential" << "t" << "At a cost of: $" << Essential.Price;
} else if (Intro = Premium.Package) {
cout<< "The Package selected is: " << "Premium" << "t" << "At a cost of: $" << Premium.Price;
} else if (Intro = Advance.Package) {
cout<< "The Package selected is: " << "Advance (Individual)" << "t" << "At a cost of: $" << Advance.Price;
} else if (Intro = Ultimate.Package) {
cout<< "The Package selected is: " << "Ultimate (Individual)" << "t" << "At a cost of: $" << Ultimate.Price;
} else if (Intro = PremiumFam.Package) {
cout<< "The Package selected is: " << "Premium (Family)" << "t" << "At a cost of: $" << PremiumFam.Price;
} else if (Intro = AdvanceFam.Package) {
cout<< "The Package selected is: " << "Advance (Family)" << "t" << "At a cost of: $" << AdvanceFam.Price;
} else {
cout<< "The Package selected is: " << "Ultimate (Family)" << "t" << "At a cost of: $" << UltimateFam.Price;
}
return 0; }
Heropig1773 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.