18.2.13
| Posted by
Sanyí, Mendoza Reyes
|
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely. Is a computer language programmers use to develop applications, scripts, or other set of instructions for a computer to execute. Below is a listing of several different programming languages and scripting languages currently listed in our database.
![]() |
Programming Community Index |
What is C++ ?
C++ is an "object oriented" programming language created by Bjarne Stroustrup and released in 1985. It implements "data abstraction" using a concept called "classes", along with other features to allow object-oriented programming. Parts of the C++ program are easily reusable and extensible; existing code is easily modifiable without actually having to change the code. C++ adds a concept called "operator overloading" not seen in the earlier OOP languages and it makes the creation of libraries much cleaner.Ref: http://www.cplusplus.com/
Hello world program !!!
At Linux: They should run the following commands in the linux terminal:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
- apt-get performing such functions as (llevar a cabo funciones tales como) installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
- apt-get update downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies.
- apt-get upgrade will fetch new versions of packages existing on the machine if APT knows about these new versions by way of apt-get update.
- build-esential séte tiene las instrucciones para instalar los paquetes esenciales para programar en C/C++ (y hacer otras cosas relacionadas con la creación de paquetes “.deb”).
$ mkdir Sanyi
$ cd Sanyi
$ gedit program.cpp
/************************************************************/
#include <time.h>
#include <iostream>
using namespace std;
void delay_s(int t);
void sleep( clock_t wait );
main(){
for(;;) {
cout<<"Hola Mundo; ...Que Tal!!!!"<<endl;
delay_s(3);
}
return 0;
}
void delay_s(int t){
clock_t clock_start;
/* holds clock start time */
clock_start = clock();
while (((clock() - clock_start) / CLOCKS_PER_SEC) < t);
}
void sleep( clock_t wait )
{
clock_t goal;
goal = wait + clock();
while( goal > clock() );
}
#include <time.h>
#include <iostream>
using namespace std;
void delay_s(int t);
void sleep( clock_t wait );
main(){
for(;;) {
cout<<"Hola Mundo; ...Que Tal!!!!"<<endl;
delay_s(3);
}
return 0;
}
void delay_s(int t){
clock_t clock_start;
/* holds clock start time */
clock_start = clock();
while (((clock() - clock_start) / CLOCKS_PER_SEC) < t);
}
void sleep( clock_t wait )
{
clock_t goal;
goal = wait + clock();
while( goal > clock() );
}
/************************************************************/
$ g++ -o program program.cpp
$ ./program
At Windows:
Bloodshed Dev-C++ is a free C++ compiler and development environment for Windows operating systems. Like most C++ compilers, it also can be used to compile ANSI C. By installing the GLUT header and library files, it can be used to write programs that use OpenGL. This is needed to run programs for Edward Angel's textbook, Interactive Computer Graphics 5th edition and possibly other computer graphics texts.
Download Dev-C++ from http://www.bloodshed.net/dev/devcpp.html and install it.
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!" << endl << endl;
system("PAUSE");
return 0;
}
The program will (hopefully) compile, run, and write its output to a DOS window. If you have the
system("pause")
statement in your program, the output will stay in the window until you hit a key. Another way to run the program (after it has been compiled) is to start a DOS window outside of the Dev-Cpp system, then navigate to the subdirectory that holds your project, and type hello.exe.
windows.h
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682087%28v=vs.85%29.aspx
#include <iostream>
#include <windows.h>
using namespace std;
void init_windows(){
HANDLE hConsole;
/*
GetLargestConsoleWindowSize() to determine the maximum size, then set it with
SetConsoleWindowInfo()
*/
//_CONSOLE_SCREEN_BUFFER_INFO info;
//GetConsoleScreenBufferInfo(hConsole,&info);
//SMALL_RECT windowMaxSize = {0, 0, info.dwMaximumWindowSize.X-1, info.dwMaximumWindowSize.Y-1};
//hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 2); // Color code
SetConsoleTitle("Sanyi Program");
//SMALL_RECT windowSize = {0, 0, 150, 30};
//SetConsoleWindowInfo(hConsole, TRUE, &windowSize);
}
int main() {
init_windows();
cout<<"\nPlease press enter to exit"<<endl;
cin.get();
return 0;
}
Subscribe to:
Posts
(Atom)