|
MoRS: ++
MoRS
02 2006 15:16
05 2018 02:30
|
-
UPD [T]:
, ,
, , .
C++?
#ASKSHIFU 59
|
Fph0EniX
08 2006 17:15
|
VC++ ? ... ... , " "... , MFC API
|
T
12 2017 21:19
|
? = )
# include <stdio.h>
"Hello, World\n");
}
$ gcc -o Hello Hello.c
$ ./Hello
Hello, World
$
|
MoRS
21 2017 16:42
21 2017 16:43
|
) |
T
23 2017 08:50
|
, ,
, , .
, - ,
, , :
span style="color: #666666;">"Hello, World\n");
}
|
T
06 2017 17:00
29 2017 20:31
|
, , .
, . 2-3 + . .
, .
, , .
++
. 2016 .
: Ը (2016)
, - 3, 1
, :
- ++
- Hello World ++
- ++
- ++
-
- ++
- ++
- XOR
- if ++
- while ++
- for ++
- switch ++
, - 3, 2
, :
-
-
- static
- ++
- ++
- ++
-
- ++
- ++
- ++
, - 3, 3
, :
- ++
- malloc() free()
- new delete
- ++
- ++
- ++
- ++
, - 3, 4
, :
- ++
- ++
-
-
- extern
, - 3, 5
, - 3, 6
, :
- . ++
- ++
- ++
-
- this
, - 3, 7
, :
- static ++
- ++
-
-
-
- ++
, - 3, 8
, :
- C++
- ++
- ++
- ++
-
-
, - 3, 9
, - 3, 10
, :
- : ++
-
-
-
-
- std::pair
, - 3, 11
, :
-
- std::vector
- std::list
- std::set
, - 3, 12
, - 3, 13
, :
- ++.
-
- . Singletone. Abstract factory.
- ++. stringstream
, - 3, 14
, :
- .
- race condition
- std::thread
- std::mutex
- deadlock
|
T
06 2017 18:02
12 2017 19:47
|
"" .
-
( OpenNet.ru Linux , , , )
"" ,
:
hello.c
hello.h
main.c
Makefile
/* hello.c */
#include <stdio.h>
"Hello World\n");
}
/* hello.h */
/* main.c */
#include "hello.h"
# Makefile for Hello World project
hello: main.o hello.o
gcc -o hello main.o hello.o
main.o: main.c
gcc -c main.c
hello.o: hello.c
gcc -c hello.c
clean:
rm -f *.o hello
(- , )
bash $ ls
hello.c hello.h main.c Makefile
$ make
gcc -c main.c
gcc -c hello.c
gcc -o hello main.o hello.o
$ ls
hello hello.c hello.h hello.o main.c main.o Makefile
$ ./hello
Hello World
bash $ nm main.o
0000000000000000 T main
U print_hello
bash $ make clean
rm -f *.o hello
$ ls
hello.c hello.h main.c Makefile
|
T
29 2017 06:26
11 2017 06:56
|
( ) (Queue).
. , , .
Element.h
/*file Element.h*/
#pragma once
// Element(void); //?
// ~Element(void); //?
Queue.h
/*file Queue.h*/
#pragma once
#include "Element.h"
Queue.cpp
/*file Queue.cpp*/
#include "Queue.h"
#include <iostream>
"Element " << e->value << " added to queue""Element " << e->value << " removed from queue""Queue is empty"", "
main-queue.cpp
/*file main-queue.cpp*/
#include "Element.h"
#include "Queue.h"
//#include <conio.h>
/*onio.h (console input-output) , , MS-DOS, . , , , ISO C POSIX.
. , DOS, Windows 3.x, Phar Lap, DOSX, OS/2 Win32 . , UNIX Linux, .*/
//void main () //nix
// . ?
{
Element e1, e2, e3, e4, e5; // Element ()
e1.value = 10; // value
e2.value = 20; //
e3.value = 30;
e4.value = 40;
e5.value = 50;
Queue q; // q
q.Put(&e2); //"" q ( )
q.Put(&e3); //
q.Put(&e1); //
q.Put(&e5); //(! " " ! )
// ( )
q.Get(); //
q.Get(); //
//
// _getch(); // :
// return 0; // . ?
}
Makefile
# Makefile for Laba-01 LIFO-FIFO (Queue&Stack:queue) project
queueapp: main-queue.o Queue.o
g++ -o queueapp main-queue.o Queue.o
main-queue.o: main-queue.cpp
g++ -c main-queue.cpp
Queue.o: Queue.cpp
g++ -c Queue.cpp
clean:
rm -f *.o queueapp
.
.
" " .
? - , ?
upd: ps . . , .
, .
upd1: ps, . . |
T
29 2017 07:21
|
... .
, - ,
- , .
...
15. , (Stack)
. ,
.
16. .
...
:
1. Stack ,
.
...
3. Stack ,
.
...
9. Stack ,
.
...
Element.h
/*file Element.h*/
#pragma once
// Element(void);
// ~Element(void);
Stack.h
/*file Stack.h*/
#pragma once
#include "Element.h"
Stack.cpp
/*file Stack.cpp*/
#include "Stack.h"
#include <iostream>
"Element " << e->value << " added to Stack" << " [count= " << count << " ]""Element " << e->value << " removed from Stack" << " [count= " << count << " ]""Stack is empty"", ""Stack is empty""[. 1] ""Stack is empty""[. 3] "//
"Stack is empty"//
//
//
//
//
//
"[. 9] " << summnechet << endl;
}
main-stack.cpp
/*main-stack.cpp*/
#include "Element.h"
#include "Stack.h"
//#include <conio.h> //. ( )
//void main () //main-stack.cpp:8:12: error: ::main must return int
// *nix ,
{
Element e1, e2, e3, e4, e5; // Element ()
e1.value = 10; // value
e2.value = 20; //
e3.value = 30;
e4.value = 40;
e5.value = 50;
Stack s; // s
s.Put(&e2); //"" s ( )
s.Put(&e3); //
s.Put(&e1); //
s.Put(&e5); //(! " " ! )
s.Put(&e4); //
// ( )
s.SummAll(); //
s.MultAll(); //
s.SummNechet(); //
s.Get(); //
s.Get(); //
//
s.SummAll(); //
s.MultAll(); //
s.SummNechet(); //
// _getch(); // :
// return 0; // , .
}
Makefile
# Makefile for Laba-01 LIFO-FIFO (Queue&Stack:stack) project
stackapp: main-stack.o Stack.o
g++ -o stackapp main-stack.o Stack.o
main-stack.o: main-stack.cpp
g++ -c main-stack.cpp
Stack.o: Stack.cpp
g++ -c Stack.cpp
clean:
rm -f *.o stackapp
- , .
- ((( |
T
29 2017 08:00
|
, " "
$ ./stackapp
Element 20 added to Stack [count= 1 ]
Element 30 added to Stack [count= 2 ]
Element 10 added to Stack [count= 3 ]
Element 50 added to Stack [count= 4 ]
Element 40 added to Stack [count= 5 ]
20, 30, 10, 50, 40,
[. 1] 150
[. 3] 12000000
|
T
29 2017 08:09
29 2017 08:21
|
, : ( ) /++ ?
, <stack>,
, peek() N ( ).
.
- . .
UPD
/usr/include/c++/
= )
|
T
02 2017 08:32
02 2017 08:33
|
/++, (make)
"" Queue Stack , Makefile
? ? , - ?
|
T
29 2017 10:53
30 2017 16:07
|
! = )
*nix`.
GetTickCount() ?
/. - .
:
...
#include <windows.h>
...
//
//
...
//
//
"\n ==> " << t3; //
...
__ linux ?
, (
...
#include <sys/times.h>
...
//
//
"t = " << t << endl;
...
... !
UPD
opennet.ru , GetTickCount
#include <sys/time.h>
|
phasma
05 2018 02:25
|
> ? ? , - ?
CMake. |
phasma
05 2018 02:30
|
> , <stack>,
STL . . |
> 1
|