HELP..!!

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2009
Posts: 14
Reputation: orthographer is an unknown quantity at this point 
Solved Threads: 0
orthographer orthographer is offline Offline
Newbie Poster

HELP..!!

 
0
  #1
Jan 27th, 2009
hey..i am a novice when it comes to C programming coz i am a bio-engineer..however, i landed a job with an It giant, and we have been allotted a project(for practice's sake though!) by them on a trainee level..ofcourse, it involves a normal-login program..i was able to figure out most of the code however i got stuck with teh bit of displaying a "*" instead of the the actual passwords(typical of most login sites)..

could someone please help me out with this..
il still produce the rest of the code which requires us to make a character sensitive comparison in case of teh password..please feel free to correct me but do offer explanations..

thanx in advance

code-->

void
fnlogincheck();
main(int argc,char**argv)
{
system("cls");
fnlogincheck();
return 0;
}
void
fnlogincheck();
{
char *pcloginid[3]={"user1","user2","user3"};
char *pcpwd[3]={"Potato","Tomato","Turnip"};
int l,p,i,c;
char login[5];
char password[6];
printf("\n\n\n\n\t\tEmployee Information System\n");
printf("\t\t===========================\n\n");
printf("\t\tLogin Screen\n");
printf("\t\t============\n");
printf("\n\t\tEnter User Id\t: ");
scanf("%c",&login);
printf("\n\t\tEnter Password\t: ");
scanf("%c",&password);


{
l=strcmp(&loginid[i], login);
p=!strcmp(&pwd[i],password);
for(i=o,i<=3,i++)
}
{
password[c]= password[6]
printf("*");
for(c=0,c<=6,c++)
}
{
if l=0,p=0
printf("LOGIN ACCEPTED");
else printf("LOGIN DENIED");

exit
}
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 146
Reputation: devnar will become famous soon enough devnar will become famous soon enough 
Solved Threads: 16
devnar's Avatar
devnar devnar is offline Offline
Junior Poster

Re: HELP..!!

 
0
  #2
Jan 27th, 2009
You gotta use code tags for people to consider answering to your post.
Here's the syntax:

[code=c]
.
.
your code here
.
.
[/code]
Anyway, just a cursory glance through your code showed a few big mistakes:

1. Use int main()
2. You are using %c to get a string- should be %s.
3. Arrays are always passed to functions using pointers (acts as call by reference- sort of).
Last edited by devnar; Jan 27th, 2009 at 4:28 am. Reason: Added more info
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: orthographer is an unknown quantity at this point 
Solved Threads: 0
orthographer orthographer is offline Offline
Newbie Poster

Re: HELP..!!

 
0
  #3
Jan 27th, 2009
  1. .
  2. .
  3. void
  4. fnlogincheck();
  5. main(int argc,char**argv)
  6. {
  7. system("cls");
  8. fnlogincheck();
  9. return 0;
  10. }
  11. void
  12. fnlogincheck();
  13. {
  14. char *pcloginid[3]={"user1","user2","user3"};
  15. char *pcpwd[3]={"Potato","Tomato","Turnip"};
  16. int l,p,i,c;
  17. char login[5];
  18. char password[6];
  19. printf("\n\n\n\n\t\tEmployee Information System\n");
  20. printf("\t\t===========================\n\n");
  21. printf("\t\tLogin Screen\n");
  22. printf("\t\t============\n");
  23. printf("\n\t\tEnter User Id\t: ");
  24. scanf("%c",&login);
  25. printf("\n\t\tEnter Password\t: ");
  26. scanf("%c",&password);
  27.  
  28.  
  29. {
  30. l=strcmp(&loginid[i], login);
  31. p=!strcmp(&pwd[i],password);
  32. for(i=o,i<=3,i++)
  33. }
  34. {
  35. password[c]= password[6]
  36. printf("*");
  37. for(c=0,c<=6,c++)
  38. }
  39. {
  40. if l=0,p=0
  41. printf("LOGIN ACCEPTED");
  42. else printf("LOGIN DENIED");
  43.  
  44. exit
  45. }
  46.  
  47.  
  48. heres the code...and the explanation as to what is wrong, is in the original post( very1st post)..
  49.  
  50. thnx..
  51. .
  52. .
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: orthographer is an unknown quantity at this point 
Solved Threads: 0
orthographer orthographer is offline Offline
Newbie Poster

Re: HELP..!!

 
0
  #4
Jan 27th, 2009
great...such an active discussion community and yet no-one to help an aspiring programmer!
nevermind..

I shall figure something out myself..
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 146
Reputation: devnar will become famous soon enough devnar will become famous soon enough 
Solved Threads: 16
devnar's Avatar
devnar devnar is offline Offline
Junior Poster

Re: HELP..!!

 
0
  #5
Jan 27th, 2009
I gave you 3 points on which to work on. You didn't bother to make any corrections in your next post or even ask questions about what I had suggested. There are a lot of other fundamental syntax mistakes too like:
The incorrect if statement syntax,
Redundant braces,
Missing semi-colons,
Illegal use of comma operator,
Use of assignment instead of comparison operator etc.
I would suggest having a look at the 'Starting C' thread.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: HELP..!!

 
0
  #6
Jan 27th, 2009
* You also didn't bother to read the rules as requested multiple times during registration (code tags and the title show that)
* you didn't format you code so people can read it
* you somehow think people are here just to bail you out of your problem and don't have lives outside of this forum
* and as devnar implied, you don't know the basic syntax of C and expect us to teach you the language. That's not why people volunteer on this board.
Last edited by WaltP; Jan 28th, 2009 at 10:58 pm. Reason: wrong name -- sorry devnar
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: orthographer is an unknown quantity at this point 
Solved Threads: 0
orthographer orthographer is offline Offline
Newbie Poster

Re: HELP..!!

 
0
  #7
Jan 28th, 2009
Well...true, I dont know the basic syntax since it has already been articulated by me that I am a novice..and Devnar, I did make amendments like you asked me to, but for some reason my compiling wont proceed beyond the third brace( and thats the only error shown by my compiler).

would it make sense for me to correct my program at three places and again produce it here when there's a plethora of mistakes in it? And mind you, my compiler does not show these as errors.

@ waltp- I am not here to ask you guys to solve my problems but to discuss and learn what the problems might be..I am not lackadaisical by any mean and I do have every ounce of grey and white matter working toward understanding this new concept which perhaps is not easy for me since I come from a Bio background.

Everyone's not adept at programming and neither is anyone born with such skills! Owing to the life I have beyond this forum, there is a dearth of time and hence, I would ask you to excuse my formatting ignorance. I shall read the formatting rules and then get back.

@ DEVNAR---> il go through the 'starting C' thread as you suggested. thank you for considering my problem though, il re-produce the code after making the changes along with the compiling errors.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 82
Reputation: riahc3 is an unknown quantity at this point 
Solved Threads: 0
riahc3 riahc3 is offline Offline
Junior Poster in Training

Re: HELP..!!

 
0
  #8
Jan 28th, 2009
My suggestion:

Take a C course in some center in your city. WILL help you out...
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: orthographer is an unknown quantity at this point 
Solved Threads: 0
orthographer orthographer is offline Offline
Newbie Poster

Re: HELP..!!

 
0
  #9
Jan 28th, 2009
Originally Posted by riahc3 View Post
My suggestion:

Take a C course in some center in your city. WILL help you out...

hey..thanx a lot for the sugestion, but i'm afraid, time is not on my side..I would be leaving in a month, and the company i will be joining already has 6 months alotted as a training period..

pus, there are a lot of other things to cater to at the moment. This was just a project given by them to us on a practice basis.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 146
Reputation: devnar will become famous soon enough devnar will become famous soon enough 
Solved Threads: 16
devnar's Avatar
devnar devnar is offline Offline
Junior Poster

Re: HELP..!!

 
0
  #10
Jan 28th, 2009
>>Take a C course in some center in your city. WILL help you out...
I think a C course is a waste of time(even when you've got some to spare). I've learned more from the Internet and Daniweb than I have from my course.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC