Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // zadanko2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include "void1.h"
- #include "void2.h"
- using namespace std;
- void funk3(int *);
- int x = 2;
- double funk4 ( int z )
- {
- return z+0.5;
- }
- int main()
- {
- int a, b, c;
- a = 2;
- b = 5;
- cout << "Liczba a = " << a << endl;
- cout << "Liczba b = " << b << endl;
- const float cv = 2.5;
- cout << "\nPodaj liczbe ktora program ma pomnozyc przez 2.5\n";
- cin >> c;
- cout << "Wynik mnozenia 2.5*" << c << "= " << cv*c << endl;
- int d = 6;
- int &ref_d = d;
- cout << "\nWartosc d = " << d << endl;
- ref_d = 1;
- cout << "Wartosc referencji d = " << ref_d << endl;
- cout << "Wartosc po referencji = " << d << endl;
- int e = 0;
- int *wsk_e = &e;
- cout << "\nWartosc e = " << e << endl;
- *wsk_e = 1;
- cout << "Wartosc referencji przy uzyciu wskaznika = " << *wsk_e << endl;
- cout << "Wartosc e po referencji = " << e << endl << endl;
- cout << "\nPrzykladowe uzycie zmiennej char f o wartosci 127" << endl;
- char f = 127;
- cout << "f jest ukazane jako znak '" << f << "'" << endl << endl;
- cout << "\nDwuelementowa tablica:" << endl;
- int *tab = new int[2];
- for (int g = 0; g < 2; g++)
- {
- cout << " ";
- cin >> tab[g];
- }
- delete[] tab;
- cout << "\nWart X przed wywolaniem:" << x << endl;
- funk1(x);
- cout << "Wart X po wywolaniu:" << x << endl;
- x = 5;
- cout << "\nWart X przed wywolaniem:" << x << endl;
- funk2(x);
- cout << "Wart X po wywolaniu:" << x << endl;
- x = 5;
- cout << "\nWart X przed wywolaniem:" << x << endl;
- funk3(&x);
- cout << "Wart X po wywolaniu:" << x << endl<<endl;
- //Tablica wskaznikow na funkcje
- double (* tab_wsk_fun [5] ) (int) ;
- tab_wsk_fun [5] = funk4 ;
- system("PAUSE");
- return 0;
- }
- void funk3(int *x)
- {
- std::cout << "wartosc X w funkcji:" << *x << std::endl;
- *x = 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement