fork download
  1. #include <iostream>
  2. using namespace std;
  3. //Class Declaration Section
  4. class LabMetaData
  5. {
  6. private:
  7. int labNum;
  8. string labTitle;
  9. string labAuthor;
  10. int Month;
  11. int Day;
  12. int Year;
  13. string labDesc;
  14.  
  15. public:
  16. LabMetaData(int labNum, string labTitle, string labAuthor,int Month, int Day, int Year, string labDesc); //constructor
  17. void setData(int, string, string, int, int, int, string);
  18. void showData();
  19. };
  20. //Class Implementation Section
  21. LabMetaData::LabMetaData(int Num, string Title, string Author, int MM, int DD, int YYYY, string Desc)
  22. {
  23. labNum = Num;
  24. labTitle = Title;
  25. labAuthor = Author;
  26. Month = MM;
  27. Day = DD;
  28. Year = YYYY;
  29. labDesc = Desc;
  30. }
  31.  
  32. void LabMetaData::SetData()
  33. {
  34. labNum = 0;
  35. labTitle = "";
  36. labAuthor = "";
  37. Month = 01;
  38. Day = 01;
  39. Year = 2012;
  40. labDesc = "";
  41. return;
  42. }
  43.  
  44. void LabMetaData::ShowData()
  45. {
  46. cout << "Lab " << labNum << ": " << labTitle;
  47. cout << "Created by: " << labAuthor;
  48. cout << Month << "/" << Day << "/" << Year;
  49. cout << labDesc;
  50. cout << endl;
  51.  
  52. return;
  53. }
  54.  
  55. int main()
  56. {
  57.  
  58. LabMetaData Lab7;
  59.  
  60. cout << endl << "Uninitialized: " << endl;
  61. Lab7.ShowData();
  62.  
  63. Lab7.SetData(7, "Lab Meta Data", "YOUR NAME", 10, 3, 2010, "Introducing basic classes.");
  64.  
  65. cout << endl << "Intialized: " << endl;
  66. Lab7.ShowData();
  67.  
  68. if(!Lab4.SetData(-1, "Test", "Test", 13, 32, 11, "Causing Errors"))
  69. cout << "\nErrors!" << endl;
  70.  
  71. cout << endl << "After Invalid Modification Attempt: " << endl;
  72. Lab7.ShowData();
  73.  
  74. cout << endl << endl;
  75. system("pause");
  76. return 0;
  77. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:32:27: error: no 'void LabMetaData::SetData()' member function declared in class 'LabMetaData'
prog.cpp:44:28: error: no 'void LabMetaData::ShowData()' member function declared in class 'LabMetaData'
prog.cpp: In function 'int main()':
prog.cpp:58:17: error: no matching function for call to 'LabMetaData::LabMetaData()'
prog.cpp:21:1: note: candidates are: LabMetaData::LabMetaData(int, std::string, std::string, int, int, int, std::string)
prog.cpp:5:1: note:                 LabMetaData::LabMetaData(const LabMetaData&)
prog.cpp:61:10: error: 'class LabMetaData' has no member named 'ShowData'
prog.cpp:63:10: error: 'class LabMetaData' has no member named 'SetData'
prog.cpp:66:10: error: 'class LabMetaData' has no member named 'ShowData'
prog.cpp:68:9: error: 'Lab4' was not declared in this scope
prog.cpp:72:10: error: 'class LabMetaData' has no member named 'ShowData'
stdout
Standard output is empty