Okie doked guys, so i have started......*ahem*..."Learning" about Visual C++ and I need some help from y'all about where i can find any resources and tools, PDF's, or anything that can help me learn about C++. I found a little tutorial online about making some sort of clock, anc i put the code into use, but for some reason, when i try to run the program, it exits almost immediately, and in the Debug Output box it says
The reason it says "HelloWorld!" is because i started with that tutorial, but moved on in the same project, coz that one wasn't also functioning, giving me the same "Exited with code 0 (0x0)"Code:'HelloWorld!.exe' (Win32): Loaded 'C:\Users\Mateusz Wierzbicki\Documents\Visual Studio 2013\Projects\HelloWorld!\Debug\HelloWorld!.exe'. Symbols loaded. 'HelloWorld!.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded. 'HelloWorld!.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded. 'HelloWorld!.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded. 'HelloWorld!.exe' (Win32): Loaded 'C:\Windows\System32\msvcp120d.dll'. Symbols loaded. 'HelloWorld!.exe' (Win32): Loaded 'C:\Windows\System32\msvcr120d.dll'. Symbols loaded. The program '[3132] HelloWorld!.exe' has exited with code 0 (0x0).
Here are the pieces of code from my other 3 Tabs of main code
TAB 1: Time in this demo.ccp
TAB 2: TimeDemo.ccpCode:// Implementation file for Time.h // Member function definitions for Time class. #include <iostream> using std::cout; #include "time.h" // Time constructor initializes each data member to zero. Time::Time() { hour = minute = second = 0; } // Set a new Time value using military time. Perform validity // checks on the data values. Set invalid values to zero. void Time::setTime(int h, int m, int s) { hour = (h >= 0 && h < 24) ? h : 0; minute = (m >= 0 && m < 60) ? m : 0; second = (s >= 0 && s < 60) ? s : 0; } // Print Time in military format void Time::printMilitary() { cout << (hour < 10 ? "0" : "") << hour << ":" << (minute < 10 ? "0" : "") << minute; } // Print time in standard format void Time::printStandard() { cout << ((hour == 0 || hour == 12) ? 12 : hour % 12) << ":" << (minute < 10 ? "0" : "") << minute << ":" << (second < 10 ? "0" : "") << second << (hour < 12 ? " AM" : " PM"); }
TAB 3: Time.hCode:// Driver for Time class #include <iostream> using std::cout; using std::endl; #include "time.h" // Driver to test class Time int main() { Time t; // instantiate object t of class time cout << "The initial military time is "; t.printMilitary(); cout << "\nThe initial standard time is "; t.printStandard(); t.setTime(13, 27, 6); cout << "\n\nMilitary time after setTime is "; t.printMilitary(); cout << "\nStandard time after setTime is "; t.printStandard(); t.setTime(99, 99, 99); // attempt invalid settings cout << "\n\nAfter attempting invalid settings : \n" << "Military time : "; t.printMilitary(); cout << "\nStandard time : "; t.printStandard(); cout << endl; }
Thanks for the helpCode:// Time class header file // Member functions are defined in time.cpp // prevent multiple inclusions of header file #ifndef TIME1_H #define TIME1_H // Time abstract data type definition class Time { public: Time(); // constructor void setTime(int, int , int); // set hour, minute, second void printMilitary(); // print military time format void printStandard(); // print standard time format private: int hour; // 0 - 23 int minute; // 0-59 int second; // 0-59 }; #endif
Best Regards
~Mister_Meh





Reply With Quote
