Cpp Summary

Embed Size (px)

Citation preview

  • 8/20/2019 Cpp Summary

    1/2

    C++ Summary

    Structuresstruct name {

    type1 element1;

    type2 element2;...

    } object_name; // instance of name name variable; // var. of type namevariable.element1; // ref. of elementname* varp; // pointer to structurevarp->element1; // member of structure

    reached with a pointer

    Console Input/Output

    C++ console I/Ocout> console in, reading from keyboardcerr 

  • 8/20/2019 Cpp Summary

    2/2

    template T Pair::GetMax(){

    T ret;ret = x>y?x:y; // return largerreturn ret;

    }

    int main () {Pair theMax (80, 45);cout