, . .
. . , . , , , . , , , .
XIX - . . . , - . IBM .
1945 . , . ..
- . . :
1- 50- . .
2- 60- . ,, .
3- . , .
4- 1971 Intel. ,-, .
.
: . 1976 Apple-1, 1977 Apple-2.
. . , , . 1980 IB M. , AppleCorporatio.
. . .
|
|
++
C++ , , . , C, - . C++ C, ++ .
C++ . , , , , . C++ , . : GNU, Microsoft Embarcadero (Borland). GNU ().
++ 1980- , BellLaboratories .
C, . . . ++. ++, C , 1980 . C, UNIX, Bell, , . , , , . C++ C, C.
1983 C C++.
: , , , . 1985 .
/C++
, C/C++, , . , . /C++, , .
C/++ .
C/++.
C ()? ++ (++)? ?
C , Unix. , . C++ , C, .
, ++ , , , .
, ++ , - . , , .
|
|
, C++ ?
C + + . . ++ CGI , ++ DOS . C++ , .
C++?
, C++ . , : . -, cppstudio.com, . .
, , . , . , , , : . , , .
, C++, . . ?
, , Windows. Linux g++, gcc Qt.
(and, or, xor, not)
, 0 (False) 1 (True). False True . . , 1 0.
, . , (1815-1864), .
, , 0() 1(). .
(AND)
AND: &
, a b. 1, a b 1, () , 0.
(OR)
OR: |
(a b). 0, a b 0 (), () , 1 ().
(XOR).
XOR: ^
(a b). XOR 1 (), a b 1 (), , 0 ().
(not)
NOT: ~
. . , NOT . .
C ++
, , . , , lw1 (laboratorywork 1)
|
|
VisualStudioCode . File>OpenFolder.
VisualStudioCode. , !
, hello.cpp :
C++. Hello, world! . :
#include<iostream> -, std::cout std::endl.
main ,
, cout endl ( endl ine), cout
File Ctrl+S:
. VisualStudioCode > CTRL + `
dir. , hello.cpp.
g++ --version. g++ C++ GCC (GNU CompilerCollections). --version, . , g++ 7.0 :
C:\Code\CppProjects>g++ --versiong++ (GCC) 7.2.0Copyright (C) 2017 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.g++ hello.cpp -o hello. hello.cpp hello.exe Windows hello Linux MacOSX. -, .
hello.exe, hello.
C:\Code\CppProjects>helloHello, world!cpp1.1
, hello.cpp, Hello, World. , Hello, World Hello, Name, Name - .
. , ; :
. , :
C:\Code\CppProjects\other>helloHello, world! C:\Code\CppProjects\other>g++ hello.cpp -o hellohello.cpp: In function 'intmain()':hello.cpp:6:1: error: expected ';' before '}' token} ^, ! C/C++ .
: , cout : cuot
. :
C:\Code\CppProjects\other>g++ hello.cpp -o hellohello.cpp: In function 'intmain()':hello.cpp:5:10: error: 'cuot' is not a member of 'std'std::cuot<< "Hello, world!" <<std::endl; ^~~~hello.cpp:5:10: note: suggested alternative: 'clog'std::cuot<< "Hello, world!" <<std::endl;^~~~clog: , , . , : clog cout. , .
|
|
cpp1.2
cout, .
hello_err.cpp, .
C
cout, , C++. : C++ C, - C.
std::puts. <cstdio>. :
del hello.exe , g++ hello.cpp -o hello hello.exe. , :
C:\Code\CppProjects\other>helloHello, world!-
, . C: std::scanf std::printf.
ab.cpp :
g++ ab.cpp -o ab. ,
: 12 88
: 12 88.7
f: 12 f
f: f
, Ctrl+Z Windows Ctrl+D ,
- , Ctrl+C .
, , . C++ //. , , . : . .
// cstdio #include<cstdio> // main, . int main (){ // a b, . int a = 0; int b = 0; // : "%d %d" // "%d" " ", // " " " " // , 2- // : https://www.opennet.ru/man.shtml?topic=scanf&category=3&russian=0 std :: scanf("%d %d", & a, & b); // : "%d %d\n" // "\n" // : https://www.opennet.ru/man.shtml?topic=printf&category=3&russian=0 std :: printf("%d %d\n",a,b);}
cpp1.3
abc.cpp , , .