By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,513 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,513 IT Pros & Developers. It's quick & easy.

C Term Project( structures, read files) Please Help

P: 6
I am working on my term project and I need help. there are some parts of it I couldnt do. the question is:
---------------
1. Write a program to create a stock for the products of a company. The following details should be stored in the system
a. Name of the product
b. Number of items available
c. Unit price
The program should let the user to look for a product using its name. Also it should be possible to update the number of items available. The program should store the data in a file for later use. On running the program the data from the file will be loaded into the memory
-------------

And I tried to solve it with examples in my course book . this is what I did so far. I am having difficulties about case 2.I messed up at case 2.If you see something wrong about my solution plaese help me.my english is not good. I hope you understand me.My solution so far:
----------------------------
Removed code per Posting Guidelines
May 28 '07 #1
Share this Question
Share on Google+
8 Replies


gpraghuram
Expert 100+
P: 1,275
HI,
You have mised a break statement in case 2:
Modify it like this
Expand|Select|Wrap|Line Numbers
  1.  case '2':
  2.                                   printf(" enter product name:");
  3.                                   scanf("%s", searchname);
  4.  
  5.                                   break;
  6.  
  7.  
I pesume that this isthe only problem you are facing.
Raghuram
May 28 '07 #2

P: 6
HI,
You have mised a break statement in case 2:
Modify it like this
Expand|Select|Wrap|Line Numbers
  1.  case '2':
  2.                                   printf(" enter product name:");
  3.                                   scanf("%s", searchname);
  4.  
  5.                                   break;
  6.  
  7.  
I pesume that this isthe only problem you are facing.
Raghuram
thnk you very much.I fixed that part. but there are lots of problems in my solution. :( anyone can help me?
May 28 '07 #3

nemisis
P: 64
thnk you very much.I fixed that part. but there are lots of problems in my solution. :( anyone can help me?

If u can post the errors here, it would be lot faster
May 28 '07 #4

AdrianH
Expert 100+
P: 1,251
Hi bttf,

There are so many things wrong with this. It is just syntacticly wrong. That you say it should work leads me to believe that you didn't write it.

Also please see our Posting Guidelines located at the top of the C/C++ Forum. You are not to post your entire code for assignments.

We at TSDN are happy to help, but you must also do your part. If you are having trouble with the syntax, say so. If you are having trouble with a section of code, show that section.

Good luck. Hope that we can help you in your programme.


Adrian
May 28 '07 #5

P: 6
If u can post the errors here, it would be lot faster
Is there any major problems with my unfinished solution.?
I am beginner at C and I have to say I am not good at it. I use DEVC++ some of errrors are :
--line 10.. two or more data types in declaration of `menuStock'
--line 32 conflicting types for 'printf'
--line 42 [Warning] data definition has no type or storage class
--line 32 a parameter list with an ellipsis can't match an empty parameter name list declaration
and there are some syntax errors :( am I solving this question in a wrong way?
May 28 '07 #6

AdrianH
Expert 100+
P: 1,251
Is there any major problems with my unfinished solution.?
I am beginner at C and I have to say I am not good at it. I use DEVC++ some of errrors are :
--line 10.. two or more data types in declaration of `menuStock'
--line 32 conflicting types for 'printf'
--line 42 [Warning] data definition has no type or storage class
--line 32 a parameter list with an ellipsis can't match an empty parameter name list declaration
and there are some syntax errors :( am I solving this question in a wrong way?
Do you understand the syntax of C?


Adrian
May 28 '07 #7

P: 6
Do you understand the syntax of C?


Adrian
I dont know that much about C :( I am having difficulties in Structures subject
May 28 '07 #8

AdrianH
Expert 100+
P: 1,251
I dont know that much about C :( I am having difficulties in Structures subject
Oh boy. Not that I don't want to help you but it is a course in itself to teach C (or any language). Do you have any programming experence? Without some, I will have to point you at searching for a C tutorial online (go to your favorite search engine and search for "C Tutorial") so that we have a comon ground to talk on.

Let me know.


Adrian
May 28 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.