| Topic Text | Topic Comments (0) | Topic Properties | Topic Information | vaibhav_warpe@per... | ||||
| Topic title: Topic 26-09 batch 3 | Wednesday October 27, 2010 06:45:32 |
Download topic text | View in monospace font | Tab width set to 8 (change to 4)
| Files in topic: | ||
| [Jump to] D:\BATCH3\trunk\sampcode.cpp | {+43,-0} | |
[Add General Comment] to topic.
| File D:\BATCH3\trunk\sampcode.cpp (Revision 1.0) | [Add File Comment] [Top] |
| 1 | //class Foo | ||
| 2 | class Foo | ||
| 3 | { | ||
| 4 | private: | ||
| 5 | int m_nValue; | ||
| 6 | |||
| 7 | public: | ||
| 8 | Foo(); | ||
| 9 | int GetValue() { return m_nValue; } | ||
| 10 | }; | ||
| 11 | |||
| 12 | Foo::Foo() | ||
| 13 | { | ||
| 14 | std::cout<<"Hello!"; | ||
| 15 | } | ||
| 16 | |||
| 17 | int func(int nValue); | ||
| 18 | |||
| 19 | //main function | ||
| 20 | int main() | ||
| 21 | { | ||
| 22 | Foo cFoo; | ||
| 23 | if (cFoo.GetValue() > 0) | ||
| 24 | // do something | ||
| 25 | else | ||
| 26 | // do something else | ||
| 27 | |||
| 28 | std::cout << func(0) << std::endl; | ||
| 29 | std::cout << func(1) << std::endl; | ||
| 30 | std::cout << func(2) << std::endl; | ||
| 31 | |||
| 32 | return 0; | ||
| 33 | } | ||
| 34 | |||
| 35 | int func(int nValue) | ||
| 36 | { | ||
| 37 | if (nValue = 0) | ||
| 38 | return 1; | ||
| 39 | else | ||
| 40 | return nValue; | ||
| 41 | } | ||
| Legend: | |
| Removed | |
| Changed | |
| Added | |
[Add General Comment] to topic.