IFD:Acoustic Interfaces/introduction to c++

From Medien Wiki
< IFD:Acoustic Interfaces
Revision as of 09:08, 11 May 2020 by Clemensw (talk | contribs) (Created page with " #include <iostream> #include <string> using namespace std; int main() { int int_number = 2147483647; // 2^32 / 2 -1 = 2^31 -1 = 2147483648 -1 // -2^31 = -2147483648...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


  1. include <iostream>
  2. include <string>

using namespace std;

int main() {

   int int_number = 2147483647; // 2^32 / 2 -1 = 2^31 -1 = 2147483648 -1 // -2^31 = -2147483648
   long long_integer = 9223372036854775807; // 2^64 / 2 - 1= 2^63 -1 = 2147483648 -1 // -2^63 = -2147483648
   float low_precision_big_float_number = 9223372036854775807; // 9.22337e+18 = 9.22337 *10^18
   double high_precision_big_float_number = 9223372036854775807; // 9.22337e+18 = 9.22337 *10^18
   
   //char are 8bit = 2^8 = 256 
   char letter_exclamation = 33; // this gets converted through ASCII table to the letter '!'
   char letter_A = 65; // this gets converted through ASCII table to the letter '!'
   
   string text = "this is a string, it's not included by default";
   
   int converted_float = 3.21;
   
   cout << "Integer:  " << int_number << endl; 
   cout << "Long Integer: " << long_integer  << endl; 
   cout << "Overflow Integer:  " << int_number + 1 << endl; 
   cout << "Overflow Long Integer: " << long_integer  +1 << endl; 
   cout << "Low precision Big float: " << low_precision_big_float_number << endl;
   cout << "High precision Big float: " << high_precision_big_float_number << endl; // command line is the bottleneck of putting out more precision
   cout << "Thats the letter '!': " << letter_exclamation << endl; 
   cout << "Thats the letter 'A': " << letter_A << endl; 
   cout << text;
   
   return 0;

}