+ 1
Student info program
My group was assigned to do this project so we split it up into three parts one did the .h file one the main file and I did the .cpp file. I need help meshing them together so the program runs. I’m new to c++ and I can’t figure it out. https://code.sololearn.com/cU0FLwHW2gfN/?ref=app https://code.sololearn.com/csBqDC7ItQDZ/?ref=app https://code.sololearn.com/c77p9qukCjlo/?ref=app
2 Antworten
+ 1
You don't need to declare the variable members again in student.cpp. As the declaration goes to h, and definition goes to cpp.
+ 1
Merging a header and an implementation file is fairly easy, just move any additional preprocessor directives, i.e. includes, to the top of the header where the existing ones are. Remove duplicate directives and exclude the include of the header you are defining. Then you can just copy-pasta the actual implementation beneath the class. Putting everything into main() is similar, except that the code goes above main(). The end result would look something like this:
https://code.sololearn.com/cp68d370l6RM/?ref=app