Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Пример4.Функции:
- //объявление и определение; список параметров; перегрузка функций
- #include <iostream>
- using namespace std;
- void func1(int x) {
- cout << x << endl;
- }
- void func2(int);
- int sqr(int x) {
- return x * x;
- }
- double sqr(double x) {
- return x * x;
- }
- void printsum(int a, int b) {
- cout << a + b << endl;
- }
- int main() {
- int x = 10;
- double y = 0.5;
- func1(x);
- func2(x);
- cout << sqr(x) << endl;
- cout << sqr(y) << endl;
- printsum(x, x);
- }
- void func2(int x) {
- cout << x << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment