IFD:Acoustic Interfaces/introduction to c++: Difference between revisions

From Medien Wiki
(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...")
 
No edit summary
Line 1: Line 1:
    #include <iostream>
    #include <string>


    using namespace std;


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

Revision as of 09:09, 11 May 2020

   #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
       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;
   }