473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Structure

4
Hi,
can any1 gif me some guidance on how 2 do such question?

Write a prog. in C to input information of eight computer suppliers who r participating in a tender to supply computer 2 skools. The information of the supplier includes tender IDNo, supplier No., Name, address and quotation price, the information read is 2 b written to an output file. The prog. then reads the output file and find the lowest quotation price and print all the information of that supplier.

Ur help is kindly appreciated. thank you.
Sep 26 '07 #1
7 1633
sicarie
4,677 Expert Mod 4TB
so what are you stuck on? What do you need help with? What do you have so far?
Sep 26 '07 #2
peru
4
so what are you stuck on? What do you need help with? What do you have so far?
actually i haf manage to done the 1st part of the qs. whereby we haf 2 include TenderIDNo....

Unfortunately when i wrote the 2nd part of the program
<the information read is to b written to an output file. The prog. then read the output file and find the lowest quotation price and prints all the information of the supplier> i had 10 errors...

actually i'm a newbies in programming and the examples provide by my teacher and my revision book is insufficient and most of the examples given r not related to tis program.
Sep 26 '07 #3
oler1s
671 Expert 512MB
Sorry to hear that your program isn't working. Telling us your program doesn't work and has 10 errors can't do much more than elicit sympathy from us. Or vague advice like, work through each error from top to bottom. Eliminate an error and compile, and repeat.

Any detailed advice would require details on your part as well. Like say, the code you wrote. And the error messages. If you think a moment, it should be obvious why we would need such details.
Sep 26 '07 #4
sicarie
4,677 Expert Mod 4TB
I'm going to agree with oler1s here. I got confused trying to follow the half completion of the first part where the second quarter (something you supposedly haven't gotten to yet?) is wrong. Anyway, I'm going to need a specific question to get everything straight in my head ;)
Sep 26 '07 #5
peru
4
Sorry to hear that your program isn't working. Telling us your program doesn't work and has 10 errors can't do much more than elicit sympathy from us. Or vague advice like, work through each error from top to bottom. Eliminate an error and compile, and repeat.

Any detailed advice would require details on your part as well. Like say, the code you wrote. And the error messages. If you think a moment, it should be obvious why we would need such details.
-----------------------------------------------------------------------------------------------------------------
Actually i haf tried solving tis problems and the prog. below is wot i haf done so far...
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. struct Supplier_record adcs[8];
  3. {int TenderID;
  4. int supplierNo;
  5. char name[20];
  6. char address[40];
  7. float quotationPrice;
  8. };
  9. struct supplier;
  10. void main()
  11. {
  12. int count, quotationPrice;
  13. float quotationPrice;
  14. FILE *fopen(),*fptr;
  15. if((fptr=fopen("quotationPrice.dat","w"))==NULL)
  16. {
  17. printf("Error in opening file\n");
  18. exit(1);
  19. }
  20. strcpy("quotationPrice to/from file");
  21. for(count=0;quotationPrice[count]!='0';count++);
  22. putc(quotationPrice[count],fptr);
  23.  
  24. fclose(fptr);
  25. if((fptr=open("quotationPrice.dat","r"))==NULL)
  26. {
  27. printf("File cannot be opened\n");
  28. exit(1);
  29. }
  30. while((quotationPrice=getc(fptr!=EOF)
  31. putfloat(price);
  32. putfloat('\n')
  33. flose(fptr);
  34. }
  35.  
I hope u can help me..!! 10q..
Sep 26 '07 #6
peru
4
I'm going to agree with oler1s here. I got confused trying to follow the half completion of the first part where the second quarter (something you supposedly haven't gotten to yet?) is wrong. Anyway, I'm going to need a specific question to get everything straight in my head ;)
Hi, i hope u can help me wif tis qs.
Actually tis is d actual question...
-------------------------------------------------------------------------------------------------------------------
Write a prog. in C to input information of eight computer suppliers who r participating in a tender to supply computer 2 skools. The information of the supplier includes tender IDNo, supplier No., Name, address and quotation price, the information read is 2 b written to an output file. The prog. then reads the output file and find the lowest quotation price and print all the information of that supplier.

Use the following structure Supplier in the program.
struct Supplier
{
int tenderID;
int supplierNo;
char name[20];
char address[40];
float quotationPrice;
};
-------------------------------------------------------------------------------------------------------------------
Actually other solutions can b accepted too and it is not necessary 2 follow d suggested solution above.

Anyway tis is wot i haf done so far
#include<stdio.h>
struct Supplier_record adcs[8];
{int TenderID;
int supplierNo;
char name[20];
char address[40];
float quotationPrice;
};
struct supplier;
void main()
{
int count, quotationPrice;
float quotationPrice;
FILE *fopen(),*fptr;
if((fptr=fopen("quotationPrice.dat","w"))==NULL)
{
printf("Error in opening file\n");
exit(1);
}
strcpy("quotationPrice to/from file");
for(count=0;quotationPrice[count]!='0';count++);
putc(quotationPrice[count],fptr);

fclose(fptr);
if((fptr=open("quotationPrice.dat","r"))==NULL)
{
printf("File cannot be opened\n");
exit(1);
}
while((quotationPrice=getc(fptr!=EOF)
putfloat(price);
putfloat('\n')
fclose(fptr);
}


I rili hope that u can help me...!!

Ur help is kindly appreciated. Thank You.
Sep 26 '07 #7
weaknessforcats
9,208 Expert Mod 8TB
I got these results when I compiled your code:

Expand|Select|Wrap|Line Numbers
  1. Warning    4    warning C4142: benign redefinition of type    c:\scratch\instructor\question2007-09-26-01.c    13    
  2. Warning    6    warning C4013: 'exit' undefined; assuming extern returning int    c:\scratch\instructor\question2007-09-26-01.c    18    
  3. Warning    7    warning C4013: 'strcpy' undefined; assuming extern returning int    c:\scratch\instructor\question2007-09-26-01.c    20    
  4. Warning    10    warning C4047: 'function' : 'int' differs in levels of indirection from 'FILE *'    c:\scratch\instructor\question2007-09-26-01.c    22    
  5. Warning    11    warning C4024: 'putc' : different types for formal and actual parameter 1    c:\scratch\instructor\question2007-09-26-01.c    22    
  6. Warning    13    warning C4013: 'open' undefined; assuming extern returning int    c:\scratch\instructor\question2007-09-26-01.c    25    
  7. Warning    14    warning C4047: '=' : 'FILE *' differs in levels of indirection from 'int'    c:\scratch\instructor\question2007-09-26-01.c    25    
  8. Warning    15    warning C4013: 'exit' undefined; assuming extern returning int    c:\scratch\instructor\question2007-09-26-01.c    28    
  9. Warning    16    warning C4047: '!=' : 'FILE *' differs in levels of indirection from 'int'    c:\scratch\instructor\question2007-09-26-01.c    30    
  10. Warning    17    warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'    c:\scratch\instructor\question2007-09-26-01.c    30    
  11. Warning    18    warning C4024: 'getc' : different types for formal and actual parameter 1    c:\scratch\instructor\question2007-09-26-01.c    30    
  12. Warning    20    warning C4013: 'putfloat' undefined; assuming extern returning int    c:\scratch\instructor\question2007-09-26-01.c    32    
  13.  
Also, main() returns an int. Not a void.

Fix this code so it compiles with no errors and no warnings, then re-post.
Sep 26 '07 #8

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

Similar topics

2
by: vikas | last post by:
I have following structure in c++. typedef struct MMF_result_struct { int action; char text; int cols,rows; int month,day,year; } MMF_result; Now this structure is shared between C++ and C#...
4
by: marco_segurini | last post by:
Hi, From my VB program I call a C++ function that gets a structure pointer like parameter. The structure has a field that contains the structure length and other fields. My problem is that...
8
by: Charles Law | last post by:
Can anyone suggest how I would marshal a variable length structure back from an API call. Specifically, I am looking at the WaitForDebugEvent function, which returns a DEBUG_EVENT structure. ...
15
by: Charles Law | last post by:
I have adapted the following code from the MSDN help for PropertyInfo SetValue. In the original code, the structure MyStructure is defined as a class MyProperty, and it works as expected. There is...
3
by: Kiran B. | last post by:
Hi, I am new to .net. I have two Data Structure Type ... Sturcture A and Structure B. Structure A Public Fname as String Public LastName as String Public City as String Public Zip as String...
14
by: Dennis | last post by:
If I have a structure like; Public Structure myStructureDef Public b() as Byte Public t as String End Structure If I pass this structure, will the values in the array b be stored on the...
10
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
11
by: Lance | last post by:
Hi all, I've got a some structures defined as ////// <StructLayout(LayoutKind.Sequential)Public Structure GM_LayerInfo_t Public mDescription As String Public mNativeRect As GM_Rectangle_t...
4
by: eBob.com | last post by:
In my class which contains the code for my worker thread I have ... Public MustInherit Class Base_Miner #Region " Delegates for accessing main UI form " Delegate Sub DelegAddProgressBar(ByVal...
5
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.