Transcription of Summary of basic C++-commands
{{id}} {{{paragraph}}}
Summary of basic C++-commandsCompilingTo compile a C++-program, you can use eitherg++orc++.g++ ++ ++ -o C++ C++ the following commands you can find at the end of this Summary command in C++ is followed by ; . Carriage return has no meaningin C++.CommentsEssential for the writing of clear programs are comments, which are explana-tions for your program, and which are ignored by the *..*/puts the text..into comment (more than one line possible)//..puts text..for rest of same line into commentData TypesData TypeDeclaration (Example)Assignment (Example)integershort i1,i2;i1 = 3;int i1,i2;long i1,i2;unsigned i1,i2;unsigned long i1,i2;realfloat f1,f2;f1 = ; f2 = ;double f1,f2;long double f1,f2;single characterchar c1,c2;c1 = R string of charactersstring s1,s2;s1 = Farmer logicalbool b1,b2;b1 = true; b2 = falseInput And OutputInput/Output With Screen:To be able to use the following commands you need to write#include <iostream>using namespace std;at the beginning of your program:output:cout << string of characters ;cout << variable; << endl;input:cin >> variable;Input/Output With Files:To be able to use the following commands you need to write#include <fstream>at the beginning of your program:output:ofstreamoutfilevariable( outputfilename ,ios::out);outfilevariable<<.
Summary of basic C++-commands Compiling To compile a C++-program, you can use either g++or c++. g++ -oexecutable filename.out sourcefilename.cc
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}
Introduction to the C Programming Language, C programming, Basics, Visual C# Programming, VISUAL C# PROGRAMMING BASICS, Programming in C: Basics, Programming, Programming with Robots, Basic Programming Concepts, C Programming Tutorial, System Programming, Visual Basic Programming, Visual Basic, C Programming Guide for FRC, PIC microcontrollers for beginners too, PIC microcontrollers, for beginners too