Jump to content

C, and a Database.

- - - - -

  • Please log in to reply
No replies to this topic

#1
DjEls

DjEls

    Newbie

  • Members
  • Pip
  • 4 posts
hey guys. im having problems understanding the C language. im a design and phtography man. no previous experience apart from basic programming in VB. im thinking about a food managing idea but i have not got a clue wher to start.

i guess C works in the same way as vb. i have a table with many foods i.e tomatos, cucumbers etc. what im trying to learn is how to link the table to C and if i type ADD in CMD. i can add a new entry to database WITHOUT opeining the table. and Remove etc. or even better. just select from 1. add. or 2.remove . if i type 1 {enter] then i can add a new column of food and enter its same such as 1 > orange > and type the quantity of it. ie. 5 or 6. and remove alows me to remove an orange so subtract 1 in effect. does this mean the console must have a function to generate a new table with previious items and add the new item to it so we now have 2 ? or can i actually modify/read/write the table. table doesnt hav to be in access. can be based in notepad or s'thin. C seems quite big and GUI isnt really my thing i jus want these simple elements just to see if i can work on this idea.

ps not so important but quetion. if another table is dependant on this table. does that mean i have to declare a constant function (as in a function to call on the items table even before adding, subtracting etc.) not quite sure how to understand C from a non mathematical mindset.


so far i hav this

now if im cleaarly going in the wrong direction please tell me. im not willing to take it sql cos thats pointless for my specifications.


// Ingredients.cpp : Defines the entry point for the console application.

//


#include "stdafx.h"



int _tmain(int argc, _TCHAR* argv[])

{

// this is the text that appears as this part of the program is accessed. where the \n are spaces between these lines of text

printf ("Welcome To The Ingredients Management Main Menu\n");

printf ("\n");

printf ("\n");

printf ("\n");

printf ("\n");

printf ("Please select an option from the following:\n");

printf ("\n");

printf ("1. Add Ingredient\n");

printf ("2. Remove Ingredient\n");

printf ("3. Review Ingredient\n");

printf ("\n");

printf ("\n");

int option[1];

// this creates a variable "option" where the amount of charecters it can enter is 1 of type "numbers only"

scanf("%d", option);

printf ("\n");

// this will confirm the selection of the user, and will ask user to wait to connect to table and initialise page

// if the user selects option 1, he will be able to add and ingredient

// otherwise if he selects option 2 then he can remove it

// and option 3 allows him to review it ingredients

if (option=1)

printf("You chose to Add Ingredient. Please wait...");

else

if (option=2)

printf("You chose to Remove Ingredient. Please wait...");

else

if (option=3)

printf("You chose to Review Ingredient. Please wait...");

printf ("\n");

return 0;


} 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users