-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathCodeDemo.cpp
More file actions
27 lines (23 loc) · 842 Bytes
/
CodeDemo.cpp
File metadata and controls
27 lines (23 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Learning C++
// Exercise 02_05
// Type inference with auto, by Eduardo Corpeño
#include <iostream>
#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);
}