Hello guys! We hope you are confident enough about C language that you are here to learn C++
No? Well we have a C Programming site that helps you out from your basics:
http://helpyoucodec.blogspot.com
Alright! Now for basics I refer "C++: The Complete Reference, 4th Edition" by Herbert Schildt. Here we try to solve most of the exercise problems as it will be helpful for you to understand whilst you go through the book as well.
Later I take up complex and new libraries like OpenCV, OpenGL, etc...
So all set to type in your FIRST C++ Program?
Lets begin with out non-traditional "Hello something":)
// main.cpp
// First Program
//
// Created by Kevin Prasanna on 28/08/13.
// Copyright (c) 2013 Kevin Prasanna. All rights reserved.
//
// include your headers
#include <iostream>
//include namespace or end up using std::cout or std::cin everywhere
using namespace std;
int main()
{
//printf is now cout with the following syntax
// "\n" can still be used but endl is C++ specific
// "\n" can still be used but endl is C++ specific
cout<<"HEY COMPUTER PRINT MY NAME : KEVIN"<<endl;
return 1;
}
Use any compiler like XCode or Visual Studio for compiling it and run to see the output:
And there goes your first C++ program.
NOTE: You will have to include <conio.h> and end the main() function with _getch(); to get the output on Visual Studio.
Stay tuned for more:) Do comment and subscribe!
No comments:
Post a Comment