Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old December 16th, 2005, 12:56 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

P.S
I will help my collegue with the information provided, thanks for your advice, but as my knowledge of programming is quite weak, i am unable to write the rest of the program as i do not understand the c++ language thoughraly, i think i might just give up, Thank you all for your advice and help, it is much appreciated and has helped quite alot... look forward to keeping updated with this website as i know i can learn alot from here...

Thanks again...
Nicolas

Reply With Quote
  #12 (permalink)  
Old December 16th, 2005, 01:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

The program would compile just do these three things

1 Delete or comment out the first main- including the curly brace following it

2 in the search book function, delete the curly brace after the line
   struct books_t;

3 replace
  int main()
    with
  void main()


Regards
Ankur Verma
Reply With Quote
  #13 (permalink)  
Old December 16th, 2005, 01:40 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have made the adjustments advised and i am still recieving a compilation error. These are the errors i am recieving:

test1.cc:252: error: `main' must return `int'
test1.cc: In function `int main(...)':
test1.cc:255: error: `books_t' undeclared (first use this function)
test1.cc:255: error: (Each undeclared identifier is reported only once for each function it appears in.)
test1.cc:255: error: expected `;' before "abook"
test1.cc:256: error: `pbook' undeclared (first use this function)
test1.cc:257: error: `abook' undeclared (first use this function)
test1.cc:263: error: invalid use of undefined type `struct std::stringstream'
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/iosfwd:84: error: declaration of `struct std::stringstream'
test1.cc: In function `int main()':
test1.cc:274: error: declaration of C function `int main()' conflicts with
test1.cc:252: error: previous declaration `int main(...)' here



Reply With Quote
  #14 (permalink)  
Old December 16th, 2005, 04:27 PM
Authorized User
 
Join Date: Nov 2005
Location: , , India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

replace int main with void main....what where did u learn that...was not expected from a moderator

Reply With Quote
  #15 (permalink)  
Old December 17th, 2005, 03:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

The ANSI standards don’t require a program with main returning anything else other
than an int, including void, to fail.

But certainly, programs with main not returning an int are unsafe and their behavior
is unreliable should anything goes wrong.

'void main' however, certainly removes a few errors for a person who is not bothered
about what’s right and what’s wrong and just trying tooth and nail to get his program
to compile at all- so many books these days show program with main returning void, and
many compiler wont even flag a warning on that, but the fact remains that ‘void main’
is incorrect.

I gather that is what you were trying to say with your query -“where did u learn that”
and not asking me the name of the university I went to, right SunnyPal?

Thanks for pointing that out.

Well, when I see something I don’t agree with in a post, I just post my point of view on
that with what I think is the corrected version of the info in the post. I find that more
constructive. But that’s me.

People who are well informed, are always welcome to this forum.
If they could help others as well
 - better yet.

Regards
Ankur Verma
Reply With Quote
  #16 (permalink)  
Old December 17th, 2005, 05:19 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help guys... but after applying the what you told me, the program is still not compiling. My deadline is on monday and the only thing i can do now is submit the program how it is and hope for the best.
Once again your help was much apprecited.
Sorry for any inconvenience..

Regards
Nicolas.

Reply With Quote
  #17 (permalink)  
Old December 18th, 2005, 09:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

You are welcome Nicolas, and I would say that your program didn’t have anything seriously wrong about it. The problems were more of those trivial syntactical typos that every beginner makes, a part of learning curve, and quite easy to get by with a little practice.

But let me tell you that if you have written this code yourself, you’ve done a pretty good job for a beginner and you deserve a pat on your back for that.

Regards
Ankur Verma
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
please help me out with this assignment... vaidehi BOOK: Beginning Linux Programming, 4th Edition ISBN 978-0-470-14762-7 3 September 10th, 2008 03:57 PM
Illegal Assignment Broodmdh Classic ASP Basics 2 August 22nd, 2008 06:21 AM
assignment pooja85jain SQL Language 1 September 2nd, 2006 11:09 AM
Java assignment greeny Java Basics 0 November 29th, 2005 08:29 AM
Java assignment greeny JSP Basics 0 November 29th, 2005 08:26 AM



All times are GMT -4. The time now is 12:49 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.