I'm working on a final project for a C programming course. The project is to create a database to store drug information. I've completed all of the elements and now it's ...
Code: #include #include #include int choice = 0; int GetInt(); int main() { while(1 == 1) { printf("1) Start Program\n"); printf("2) End Program\n"); choice = GetInt(); if (choice == 1) printf("Starting a new program...\n"); if (choice == 2) exit(1); } } int GetInt() { /* Init a Char variable with value -1 to not jump out of the ...
Well if you know the user has to place an "R'" as input, and if they also press "T" for the error, you may want to catch this, by scanning for that as well. Then checking your input to see if an "R" or "T" was placed. scanf() will just place erroneous data on the input queue if there is no ...
RETURN VALUES These functions return the number of input items assigned, which can be fewer than provided for, or even zero, in the event of a matching failure. Zero indicates that, while there was input available, no conversions were assigned; typically this is due to an invalid input character, such as an alphabetic character for a `%d' conversion. The value EOF ...
Hi all, this is probably the first time I have ever actually asked a question on the board, so Ill give it my best. This is a simple homework assignment, and I have pretty much finished except for a weird bug that won't go away. The point of the assignment is dealing with how to store data in a much smaller ...
Hi, I am trying to obtain a number using scanf. But, I want to make sure the input is only integer, not characters. I have made some progress on C, but its loopping indefieniently and have some errors. #include #include #include int get_number(void); int get_number() { int check = 0, number = 0; do { if( check > ...
Hi, i am trying to create a stack library and in order to test it works i have created a test program (StackTest.c). I have designed a menu system that has worked for me before in java but it doesnt seem to work here. Basically the tester will bring up a menu for the user to select an option by inputting ...
I have a small program that I am doing for a class. The program runs off of a small menu consisting of 6 choices. The program works if an integer is entered. If a decimal or alpha character or string is entered, the program loops endlessly. I read this is common for scanf. I was trying to error check for anything ...