Size: 705
Comment:
|
Size: 1947
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
{{{ | {{{#!highlight c++ |
Line 9: | Line 9: |
g++ test.cpp -o test | |
Line 35: | Line 36: |
/* To compile in gcc container g++ test.cpp -o test g++ (GCC) 8.2.0 */ #include<vector> #include<iostream> #include<sstream> #include<random> #include<ctime> class Teste{ public: Teste(std::string xyz){ std::cout << xyz << "\r\n"; } }; int main(){ std::vector<int> listInst = std::vector<int>(); std::cout <<"Hello world \r\n"; std::ostringstream oss(std::ostringstream::out); int a = 1234; char xpto[16]="AAA BBB"; oss << a << xpto << "\r\n"; std::cout << oss.str(); //std::ostringstream ost = std::ostringstream(ostringstream::out); Teste x1("Ola aaaaaaa"); srand( (unsigned) time(0) ); std::cout << rand() <<"\n"; std::cout << rand() <<"\n"; std::cout << std::to_string(1234) << " " << std::to_string(34.56) << "\n"; return 0; } |
|
Line 36: | Line 75: |
== dummy1.cpp == {{{#!highlight cpp /** g++ dummy1.cpp -o dummy1 */ #include <iostream> #include <string> using namespace std; int main(){ std::string input; std::cout <<"Hello world \r\n"; cout << ">"; std::cin >> input; std::cout << input << "!!!\n"; char x[128]; std::cout << ">"; cin >> x; std::cout << x << "???\n"; return 0; } }}} |
CPlusPlus
C++ programming language created by Bjarne Stroustrup
Sample app for Linux
1 /*
2 gcc test.cpp -lstdc++ -o test
3 cpp test.cpp -o test
4 g++ test.cpp -o test
5 */
6
7 #include<vector>
8 #include<iostream>
9 #include<sstream>
10
11 class Teste{
12 public:
13 Teste(std::string xyz){
14 std::cout << xyz << "\r\n";
15 }
16 };
17
18 int main(){
19 std::vector<int> listInst = std::vector<int>();
20 std::cout <<"Hello world \r\n";
21 std::ostringstream oss(std::ostringstream::out);
22 int a = 1234;
23 char xpto[16]="AAA BBB";
24 oss << a << xpto << "\r\n";
25
26 std::cout << oss.str();
27 //std::ostringstream ost = std::ostringstream(ostringstream::out);
28 Teste x1("Ola aaaaaaa");
29 return 0;
30 }
31
32 /*
33 To compile in gcc container
34 g++ test.cpp -o test
35
36 g++ (GCC) 8.2.0
37 */
38 #include<vector>
39 #include<iostream>
40 #include<sstream>
41 #include<random>
42 #include<ctime>
43
44 class Teste{
45 public:
46 Teste(std::string xyz){
47 std::cout << xyz << "\r\n";
48 }
49 };
50
51 int main(){
52 std::vector<int> listInst = std::vector<int>();
53 std::cout <<"Hello world \r\n";
54 std::ostringstream oss(std::ostringstream::out);
55 int a = 1234;
56 char xpto[16]="AAA BBB";
57 oss << a << xpto << "\r\n";
58
59 std::cout << oss.str();
60 //std::ostringstream ost = std::ostringstream(ostringstream::out);
61 Teste x1("Ola aaaaaaa");
62 srand( (unsigned) time(0) );
63 std::cout << rand() <<"\n";
64 std::cout << rand() <<"\n";
65 std::cout << std::to_string(1234) << " " << std::to_string(34.56) << "\n";
66 return 0;
67 }
dummy1.cpp
1 /**
2 g++ dummy1.cpp -o dummy1
3 */
4 #include <iostream>
5 #include <string>
6 using namespace std;
7
8 int main(){
9 std::string input;
10 std::cout <<"Hello world \r\n";
11 cout << ">";
12 std::cin >> input;
13 std::cout << input << "!!!\n";
14 char x[128];
15 std::cout << ">";
16 cin >> x;
17 std::cout << x << "???\n";
18 return 0;
19 }