Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Tevong

Someone correct this simple program quickly please

This topic is 6110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve decided to try MVC++ compiler after DEV-C++ but this simple program won''t work: #include #include int main() { struct PERSON { int age; char name[20]; float height; }; PERSON Tevong; Tevong.age=16; strcpy(Tevong.name,"Tevong"); Tevong.height=1.74; cout<

Share this post


Link to post
Share on other sites
Advertisement
You also need string.h to use strcpy:

#include <stdio.h>
#include <string.h>


Edited by - nickm on October 30, 2001 1:22:08 PM

Share this post


Link to post
Share on other sites
stdio.h and iostream.h didn''t paste for some reason.. I included those two.

I didn''t include string.h, in DEV-C++ it worked without having to include anything else.

I''ll try that thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by Tevong
And also, is it possible to make constructors for structs as well as classes? If so, how?

structs in C++ are equivalent to classes with a default visibility (access specification) of public rather than private. Create constructors the same way you do for classes.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!