char main()/*Start of the function main???*/
{
char choice1;
char choices = 'y';
while(choices == 'y' && choices != 'n'){/*while loop initialization*/
print();
getchar();
scanf("%c",&choice1);
printf("%c",choice1);
switch(choice1){/*Switch case statement,,,*/
case 'a':
case 'A':
addContact();
break;
case 'f':
case 'F':
search(contacts);
break;
case 'v':
case 'V':
list();
break;
case 'e':
case 'E':
edit(contacts);
break;
case 'd':
case 'D':
list();
printf("Which contact do you to delete?\n");
deleteCont(contacts);
default:
printf("You pressed 1 EXIT status!!!!\n");
}/*end of switch case...*/
printf("\nIs there anything you want to add?Y/N");/*while loop update!!!*/
getchar();
scanf("%c",&choices);
}
}/*end of function main()*/
syria718
0
Newbie Poster
Recommended Answers
Jump to Post> Last edited by syria718; 24 Minutes Ago at 09:15. Reason: i cant'n post perfectly sorry,,
It seems you still can't - you still haven't figured out [code]
[/code] tags.
How many hints do you need to do this?
Jump to Postgetchar(); scanf("%c",&choice1);
When you type something for getchar and press enter, the linefeed '\n' goes into the choice1. That is scanf will not prompt the user to enter a character. Instead it will take the last key you pressed for getchar()
Jump to PostIf you check syria's second post that includes his code it says "char main()" so I assumed it was correct
Yeah, it's not really the best practice to assume any kind of correctness from the code of obvious novices. ;) But hey, you can use this as a heads up …
All 11 Replies
syria718
0
Newbie Poster
syria718
0
Newbie Poster
Salem
5,138
Posting Sage
Arbus
25
Practically a Master Poster
mtatadotcom
-1
Newbie Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
vincenzorm117
-4
Newbie Poster
WaltP
commented:
We don't want YOU to make a solition, we want you to help HIM find his own solution. Give him help, not a handout.
-4
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Narue
5,707
Bad Cop
Team Colleague
vincenzorm117
-4
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
Salem
commented:
win indeed
+17
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.