Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

c++ - How to implement files in the main.cpp file?

I have a C++ project that I am working on. I have five files that I am working with, they are as follows

1. main.cpp
2. Account.h
3. ListDA.h
4. Account.cpp
5. ListDA.cpp

I need to implement the files in the main.cpp but I am not sure how to exactly do that or which of the files listed I need to do that with. I have code written in each of the files but the code I have in the main.cpp is not doing what I am wanting it to do.

I know it's because of the lack of code I have for it to preform but I am not sure how to exactly write the code I need to preform those actions.

I am a little lost. Any advise is helpful. If you need more information to give advise please let me know I will do the best I can. Thanks

I got that issue fixed but when I run the program it is not doing what I want it to do. I thought all the code I need is in the 5 files I have for it. Any help please?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

if the .cpp files are #include-ing their header file, all you need to do is to include the headerfiles in the main. Is that what you wanted to do?

main:

#include List.h 
#include account.h

Account.cpp

#include account.h

Same thing for list.cpp


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...