Skip to content

pranavnathe/CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++

to run code

g++ hello_world.cpp && ./a.out

add -std=c++11 to run vector code

g++ -std=c++11 code.cpp && ./a.out

Note

This syntax will work on mac system only.

Data Types

Primitive

  • int - 4 Bytes
  • char - 1 Bytes
  • float - 4 Bytes
  • double - 8 Bytes
  • bool - 1 Bytes

Type Casting

Converting data from one type to another

  • Conversion [implicit]

    • Small to big

      float (4 bytes) to double (8 bytes)

  • Casting [explicit]

    • Big to Small

      double to int

      double price = 100.99;
      
      int newPrice = (int)price;
      cout << newPrice << endl;
      
      output:
      100
      

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages