TipiWiki2

[ CplusPlus.2006-12-14-11-23 ]

edit | Recent Changes | Find Page | All Pages | Front Page |

http://www.informatik.uni-ulm.de/rs/lehre/ProgCppp2005/ (C++ und C+++)


http://cppreference.com/ "Brauchbare C/C++ Referenz"
http://hem.passagen.se/erinyq/industrial/ Buch: Industrial Strength C++
http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html Buch: Bruce Eckel's Mindview


http://www.home.unix-ag.org/martin/c++.ring.buch.html (Vergleich Pascal, C++)
http://www.igpm.rwth-aachen.de/lehre/C++/2005ws/ (Kurs, RWTH)
http://www.lrz-muenchen.de/~ebner/C++/Slides/cxxkurs.html (kurz und bündig!)

Visual C++ vs. gcc (Linux)

- Pi muss definiert werden

#define M_PI 3.14159265358979323846	// nur VC++
- inline muss evtl. mit einem speziellen Befehl deklariert werden
__inline int round(float f)			// nur VC++

Datei schreiben mit Linefeed (0a)

schreibt man mittels ofstream eine Datei ohne weitere Angaben, so wird ein

<< endl
<< '\n'
als (s. Hex-Editor) 0d0a geschrieben. Abhilfe: öffnen der Datei als binary:

ofstream fout("dateiname.dat",fstream::binary);

Datei schreiben

#include <iostream>
#include <fstream>

using namespace std;
ofstream fout("c:\\verzeichnis\out.dat");
fout << ...;
fout.close();

String in float


atof (C) or in C++

#include <iostream>
#include <sstream>
 
using namespace std;

int main(){
  istringstream is("3.14");
  float pi;
  is >> pi;
  cout << pi << endl;
} 

beliebte Fehler:

Info

sprintf("%.2f", floatvariable)
rundet auf 2 Nachkommastellen

Code für Linux UND Windows (mit gcc, ...)

#ifdef LINUX
   gnuplotpipe=popen("gnuplot","w");
#endif
#ifdef WIN32
   gnuplotpipe=popen("c:\\gnuplot\\bin\\pgnuplot","w");
#endif