no program
Printable View
no program
Dude....
What exactly is the problem? What exactly is not working?
We don't have the time or ambition to go through that much code. Why not post the compiler's error message along with it?
their are no compiler errors it just does not do wont I wont it to do like this if statment which is to display the membership fee but it will not work
Code:/* Membership fee*/
if ( Member.Membership == "Premium" ){
printf ("Membership fee per annum: %d\n", Premium);
}
if ( Member.Membership == "Standard" ) {
printf ("Membership fee per annum: %d\n", Standard);
}
if (Member.Membership == "Junior") {
printf ("Membership fee per annum: %d\n", Junior);
}
else
{
printf ("Unable to work out the membership fee!\n");
}
it just displays Unable to work out the membership fee!
Read up on strcmp for how to compare 2 nullterminated strings with eachother.
C does not know how to do this.
C does not have a built in string type that you can manipulate in that way. It does, however, have a large number of library routines that will treat a character array as a string and perform string-like operations for you. In this case you should be interested in stricmp()....
Hold on Bob! There is hope, I'm working on a fix for you, just keep checking back.
ok Lenna
I'm almost done. I decided to re-write your source from scratch to accomplish the task. I'll be a few more minutes.
Yeah, that's a great idea Lenna_Pengy; instead of letting Bob learn how to use strcmp, why don't you just go right ahead and rewrite his homework for him. New to programming forums, are we?
Make sure you don't just post that huge chunk of code here; keep the homework policy in mind. "Rewriting the code from scratch" doesn't really fit the purpose.
I am rewriting his homework yes, but in a way that he has to learn it. I can see you're not very new to looking at membership details. Coincidentally this entire thread is about a program relating to membership details. Why not use your 1337 membership skills to help bob come to a solution rather than pick apart what I'm doing.
Because neither rags_to_riches nor myself see any problem with the guidance that has already been provided by shakti and CommonTater which has pointed out the difficulty and suggested a method of fixing it, which were even posted before your "offer" of rewriting the code. Have you even read the rest of the thread?
I am providing additonal guidance. I have read the rest of the thread. Have you also noticed that his source is written by 3 different programmers? XD
Anyway! Here is the basic framework you'll want to use bob, you can modify it and expand it into what you need. This should help.
Using a layout similar to this and flags for just about everything, you should be able to write your code around this. Just a simple and very incomplete indexing system. I would suggest using BCX for compiling when you finish for C.Code:stt:
cls
admn$ = "admin"
pw$ = "hello"
'-------------------
'whichever you prefer, integer or string, you could just use a basic parsing script though
st1$ = st1%
st2$ = st2%
st3$ = st3%
'st1 is premium
'st2 is standard
'st3 is junior
st1% = 1 'premium
st2% = 2 'standard
st3% = 3 'junior
'----membership stuff
totalp% = 0
totals% = 0
totalj% = 0
totalm% = 0 'total number of members
'----------membership ID's
mem1% = st1%
mem2% = st2%
mem3% = st3%
mem4% = st2%
mem5% =
'-------------
'admin login-------------
print "Admin login: "
input A$
print "Admin Pass: "
input P$
if P$ = pw$ and A$ = admn$ goto accepted
if P$ <> pw$ and A$ <> admn$ goto stt
'---------------------------
'accepted login----------------
accepted:
cls
print "Welcome Bob!"
?
print "what would you like to do?"
print "1. View all premium members"
print "2. View all standard members"
print "3. View all junior members"
print "4. look up member by ID"
print "5. look members by name"
print "6. Display all expiring memberships by month"
input N$
if N$ =1 goto prem
if N$ =2 goto stan
if N$ =3 goto jun
if N$ =4 goto ID
if N$ =5 goto nam
if N$ =6 goto ex
if N$ <> "1" or N$ <> "2" or N$ <> "3" or N$ <> "4" or N$ <> "5" or N$ <> "6" goto accepted
'-------this is for our premium members
prem:
cls
color 15
print "Currently displaying all Premium members"
if mem1% = st1% gosub 1mem
if mem2% = st1% gosub 1mem
if mem3% = st1% gosub 1mem
if mem4% = st1% gosub 1mem
if mem5% = st1% gosub 1mem