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, login);
p=!strcmp(&pwd,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
}

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).

.
.
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
} 


heres the code...and the explanation as to what is wrong, is in the original post( very1st post)..

thnx..
.
.

great...such an active discussion community and yet no-one to help an aspiring programmer!
nevermind..

I shall figure something out myself..

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.

* 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.

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.

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.

>>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.

>>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.

yeah..thats what I am trying to do..go through various posts and take in the suggestions and understand syntaxes while I can.

>>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.

Even if you have no idea about programming like this guy does?

Obviously, he doesnt like programming either so a course with indivdual (sp?) help will help him.

Even if you have no idea about programming like this guy does?

Obviously, he doesnt like programming either so a course with indivdual (sp?) help will help him.

christ!!! well..I would love to take a course in C if and IF i had the time to do so...I might be less efficient in C but given some time, I can definitely catch up..

But for that, I would require a lot of practice and clarity of concepts..Ofcourse, Biology isnt like computers..

What you need is a tutorial that you can do at whatever speed you can handle. This post may help you find one suitable. Or the thread on books.

This article has been dead for over six months. Start a new discussion instead.