Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Ch00/CodeDemo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Learning C++
// Exercise 00_03
// Exercise 00_03 with modifications
// Using the exercise files on GitHub, by Eduardo Corpeño

#include <iostream>
Expand Down
22 changes: 20 additions & 2 deletions src/Ch02/02_03b/CodeDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,27 @@

#include <iostream>

int a, b = 5; // single line comment

/* Multi
* line
* comment */

int main(){
std::cout << "Hi There!" << std::endl;

bool my_flag;
a = 7;
my_flag = false;
std::cout << "a = " << a << std::endl;
std::cout << "b = " << b << std::endl;
std::cout << "flag = " << my_flag << std::endl;
my_flag = true;
std::cout << "flag = " << my_flag << std::endl;
std::cout << "a + b = " << a + b << std::endl;
std::cout << "b - a = " << b - a << std::endl;
unsigned int positive;
positive = b - a;
std::cout << "b - a (unsigned) = " << positive << std::endl;

std::cout << std::endl << std::endl;
return (0);
}
17 changes: 16 additions & 1 deletion src/Ch02/02_05b/CodeDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@
#include <typeinfo>

int main(){

auto a = 8;
auto b = 12345678901;
auto c = 3.14f;
auto d = 3.14;
auto e = true;
auto f = 'd';
auto g = "C++ rocks!";

std::cout << "The type of a is " << typeid(a).name() << std::endl;
std::cout << "The type of b is " << typeid(b).name() << std::endl;
std::cout << "The type of c is " << typeid(c).name() << std::endl;
std::cout << "The type of d is " << typeid(d).name() << std::endl;
std::cout << "The type of e is " << typeid(e).name() << std::endl;
std::cout << "The type of f is " << typeid(f).name() << std::endl;
std::cout << "The type of g is " << typeid(g).name() << std::endl;

std::cout << std::endl << std::endl;
return (0);
}