#include <stdio.h>
#include <ctype.h>
int main(void)
{
int c, wassp;
wassp = 1;
while ((c = getchar()) != EOF) {
if (isspace(c))
wassp = 1;
else if (wassp) {
wassp = 0;
putchar(c);
}
}
putchar('\n');
return 0;
}
[guest@localhost c]$ .ansi t.c -o t
[guest@localhost c]$ echo "abcd efgh ijkl" | ./t
aei
[guest@localhost c]$
>>> class UnorderedList:
... def __init__(self):
... self.head = None
...
... def append(self, item):
... newnode = Node(item)
... if self.head is None:
... self.head = newnode
... return
... current = self.head
... while True:
... nextnode = current.getNext()
... if nextnode is None:
... break
... current = nextnode
... current.setNext(newnode)
...
... def print(self):
... current = self.head
... while current is not None:
... print(current.getData(), end=' ')
... current = current.getNext()
... print()
...
>>> class Node:
... def __init__(self, data):
... self.data = data
... self.next = None
...
... def getData(self):
... return self.data
...
... def getNext(self):
... return self.next
...
... def setData(self, data):
... self.data = data
...
... def setNext(self, node):
... self.next = node
...
>>> lst = UnorderedList()
>>> lst.append(1)
>>> lst.append(2)
>>> lst.append(3)
>>> lst.print()
1 2 3
>>>
В самом начале создаем 1 элемент стека "top" (он же пока что и является верхним) при помощи конструктора с полями key = NULL, deeperElement = NULL;
>>> lst = [1, 2, 3, 4, 5] * 10
>>>
>>> out = [n * 2 if i % 9 == 0 else n
... for i, n in enumerate(lst, 1)]
>>> out
[1, 2, 3, 4, 5, 1, 2, 3, 8, 5, 1, 2, 3, 4, 5, 1, 2, 6, 4, 5, 1, 2, 3, 4, 5, 1, 4, 3, 4, 5, 1, 2, 3, 4, 5, 2, 2, 3, 4, 5, 1, 2, 3, 4, 10, 1, 2, 3, 4, 5]
>>>
int main(int argc, char *argv[])
int main(int argc, char **argv)
void func(char ***p) { (*p)++; }
...
func(&argv);
#include <iostream>
using namespace std;
void func(char ***p)
{
(*p)++;
}
int main(int argc, char *argv[])
{
cout << argv << " " << *argv << endl;
func(&argv);
cout << argv << " " << ((*argv) ? *argv : "no") << endl;
return 0;
}
[guest@localhost cpp]$ .iso++ t.cpp -o t
[guest@localhost cpp]$ ./t
0xbffc3114 ./t
0xbffc3118 no
[guest@localhost cpp]$ ./t a
0xbf999594 ./t
0xbf999598 a
[guest@localhost cpp]$
Кратко о программе которую я хочу написать. Это база данных собственных ошибок (в разных областях)
while (cond) {
f1();
f2(); f3();
}
int func(int x)
{
return x / 10;
}
...
a = func(a);