This example uses streams to write text to a file
#include<iostream.h>
#include<fstream.h>
int main()
{
// first lets output to a file
ofstream fout(“sample.txt”);
fout << “programmershelp” << endl;
fout.close();
char str[20];
//read in the file
ifstream fin(“sample.txt”);
fin >> str;
fin.close();
//display sample.txt contents
cout << “data read from file: ” << str << endl;
return 0;
}
Bookmark It
Hide Sites
$$(‘div.d110′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });
Octal / Hexadecimal / Decimal conversion
#include <iostream.h>
#include <iomanip.h> int main()
{
cout<<”The decimal value of 15 is “<<15<<endl;
cout<<”The octal value of 15 is “<<setiosflags(ios::oct)<<15<<endl;
cout<<”The hex value of 15 is “<<setiosflags(ios::hex)<<15<<endl;
return 0;
}
Bookmark It
Hide Sites
$$(‘div.d48′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });
C++ Fundamentals
C++ is a programming language that is both procedure-oriented and object-oriented. VTC author Tim Heagarty builds on what you learned in C Programming and adds the basic structure and procedures of C++. With an emphasis on OOP you will learn constructors, classes, templates, exception handling and more. To start learning about C++ now, click [...]