(tested class highlighting in wiki playground) Tags: apiedit Visual edit |
(Moved int success into main function because global variables should be avoided and this usage was bad. Also added using namespace std to shorten code.) Tags: apiedit Visual edit |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
<syntaxhighlight lang="cpp"> |
<syntaxhighlight lang="cpp"> |
||
− | #include < |
+ | #include <iostream> |
+ | using namespace std; |
||
⚫ | |||
+ | |||
⚫ | |||
+ | { |
||
public: |
public: |
||
int testVar_; |
int testVar_; |
||
Line 11: | Line 14: | ||
int main() // "void main" is, and was always, wrong |
int main() // "void main" is, and was always, wrong |
||
{ |
{ |
||
+ | int success; |
||
⚫ | |||
− | return |
+ | cout<<"Enter return success number, please."<<endl; |
+ | cin>>success; |
||
⚫ | |||
+ | return success; |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
Latest revision as of 03:45, 12 August 2015
This page is intended to test Wikia features or the editors.
#include <iostream>
using namespace std;
class TestClass
{
public:
int testVar_;
};
int main() // "void main" is, and was always, wrong
{
int success;
cout<<"Enter return success number, please."<<endl;
cin>>success;
cout<<"C++ code!"<<endl;
return success;
}