Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit df3f754

Browse files
Test program
1 parent a712ca8 commit df3f754

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

‎CPP_Module_07/ex00/main.cpp‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* ************************************************************************** */
2+
/* */
3+
/* ::: :::::::: */
4+
/* main.cpp :+: :+: :+: */
5+
/* +:+ +:+ +:+ */
6+
/* By: shovsepy <marvin@42.fr> +#+ +:+ +#+ */
7+
/* +#+#+#+#+#+ +#+ */
8+
/* Created: 2022年02月01日 21:27:11 by shovsepy #+# #+# */
9+
/* Updated: 2022年02月01日 21:32:18 by shovsepy ### ########.fr */
10+
/* */
11+
/* ************************************************************************** */
12+
13+
#include "whatever.hpp"
14+
#include <iostream>
15+
#include <string>
16+
17+
int main( void ) {
18+
int a, b;
19+
float c, d;
20+
char e, f;
21+
std::string g, h;
22+
23+
a = 1;
24+
b = 2;
25+
c = 4.2f;
26+
d = 42.21f;
27+
e = 'x';
28+
f = 'y';
29+
g = "string1";
30+
h = "string2";
31+
32+
std::cout << "Data to play with\n" << std::endl;
33+
std::cout << "a: " << a << " and b: " << b << std::endl;
34+
std::cout << "c: " << c << " and d: " << d << std::endl;
35+
std::cout << "e: " << e << " and f: " << f << std::endl;
36+
std::cout << "g: " << g << " and h: " << h << std::endl;
37+
38+
std::cout << "\nNow calling swap on all of these...\n" << std::endl;
39+
::swap(a, b);
40+
::swap(c, d);
41+
::swap(e, f);
42+
::swap(g, h);
43+
44+
std::cout << "a: " << a << " and b: " << b << std::endl;
45+
std::cout << "c: " << c << " and d: " << d << std::endl;
46+
std::cout << "e: " << e << " and f: " << f << std::endl;
47+
std::cout << "g: " << g << " and h: " << h << std::endl;
48+
49+
std::cout << "\nLet's find the mins and maxs...\n" << std::endl;
50+
std::cout << "min(a, b): " << ::min(a, b) << std::endl;
51+
std::cout << "max(a, b): " << ::max(a, b) << std::endl;
52+
std::cout << "min(c, d): " << ::min(c, d) << std::endl;
53+
std::cout << "max(c, d): " << ::max(c, d) << std::endl;
54+
std::cout << "min(e, f): " << ::min(e, f) << std::endl;
55+
std::cout << "max(e, f): " << ::max(e, f) << std::endl;
56+
std::cout << "min(g, h): " << ::min(g, h) << std::endl;
57+
std::cout << "max(g, h): " << ::max(g, h) << std::endl;
58+
59+
return 0;
60+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /