Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ГОСЫ / practical_part.odt
Скачиваний:
26
Добавлен:
05.06.2015
Размер:
30.78 Кб
Скачать

Int main() {

Stack stack;

//default

stack.push(1);

stack.push(2);

cout << "List of commands:" << endl;

cout << "\t push" << endl;

cout << "\t pop" << endl;

cout << "\t quite" << endl;

cout << endl;

bool quite = false;

string cmd = "";

while (! quite) {

cout << "Input command: ";

cin >> cmd;

if (cmd == "pop") {

if (! stack.empty() )

cout << " " << stack.pop() << endl;

else

cout << "The stack is empty!" << endl;

} else if ( cmd == "push" ) {

int val; cout << " Input value: "; cin >> val;

stack.push(val);

} else if ( cmd == "quite" || cmd == "q" || cmd == "exit") {

quite = true;

cout << "exit" << endl;

} else {

cout << "Unknown command!" << endl;

}

}

return 0;

}

39

#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

void outputArray(int* array, int& size) {

cout << " array = [ ";

for(int i = 0; i < size; i++)

cout << array[i] << ", ";

cout << "]" << endl;

}

int main(int argc, char const *argv[]){

int size = 3;

cout << "Input size of array = "; cin >> size;

int* array = new int[size];

cout << "Input array:" << endl;

for(int i = 0; i < size; i++) {

cout << " array[" << i << "] = "; cin >> array[i];

}

cout << "\nInputed array:" << endl;

outputArray(array, size);

int n = 5; cout << "Input N = "; cin >> n;

int count = 0;

for(int i = 0; i < size; i++)

count += array[i] == n ? 1 : 0;

cout << "\nN occurrences in inputed array " << count << " times " << endl;

return 0;

}

40

style.css

html {

font-size: 24pt;

}

a:link { /*цвет линки*/

color: orange;

font-weight: bold;

}

a:hover { /*цвет при наведение курсора*/

color: red;

}

a:visited { /*цвет ссылок по которым уже перешли*/

color: green;

}

a:active { /*цвет ссылки при нажатии на неё*/

color: blue;

}

prog.html

<html>

<head>

<title></title>

<link href="style.css" rel="stylesheet" type="text/css">

</head>

<body>

<a href="">Test</a></br>

<a href="">Test</a></br>

<a href="">Test</a></br>

<a href="">Test</a></br>

</body>

</html>

33, 38 Assembler!!!

39

Соседние файлы в папке ГОСЫ