Hello shamar,
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
string firstname;
string lastname;
int code;
double dues;
char key;
string name;
cout<<"Please Enter first name: ";
cin>>firstname;
cout<<"Please Enter last name: ";
cin>>lastname;
cout<<"Enter a code for membership type: ";
cin>>code;
cout<<"Enter dues: ";
cin>>dues;
cout<<"\nEnter your code to view your dues: ";
cin>>code;
if (key >= '100' )
{
cout<<"Dues to be collected: "<<dues<<endl;
}
cout<<"Welcome " <<firstname<< <<lastname>>endl;
return 0;
}
|
Lines 26 and 27 are redundant. You already ased this for "code" at lines 20 and 21.
Line 29 at this point "key" does not have a value and then you are trying to compare a single character to a constant string which have the wrong quotation marks.
After line 21 it would be best to print the dues expected before you enter the dues collected.
The instructions mentions "(see table below)", but there was no table to look at. I am guessing that this table lists the amount of dues for each type. Useful information when writing a program.
What you have is not what I started with, but it can be made to work.
Looking at the second paragraph can give you an idea of what variables you will need.
Hope that helps,
Andy