vertc

10-01

Jan 10th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void napis() {
  6.     cout<<"kappa";
  7. }
  8.    
  9. int main() {
  10.     napis();
  11. }
  12.  
  13. -------------------------------------------------------------------------------------
  14.  
  15. #include <iostream>
  16. #include <string>
  17.  
  18. using namespace std;
  19.  
  20. void f1(string a) {
  21.     cout<<"Witaj, "<<a;
  22. }
  23.  
  24. int main() {
  25.     f1("Janusz");
  26.     return 0;
  27. }
  28.  
  29. -------------------------------------------------------------------------------------
  30.  
  31. #include <iostream>
  32. #include <string>
  33.  
  34. using namespace std;
  35.  
  36. void f1(int wiek, string imie) {
  37.     cout<<imie<<" ma "<<wiek<<" lat.";
  38. }
  39.  
  40. int main() {
  41.     f1(5, "Janek");
  42.     return 0;
  43. }
  44.  
  45. -------------------------------------------------------------------------------------
  46.  
  47. #include <iostream>
  48.  
  49. using namespace std;
  50.  
  51. int f1(int a, int b) {
  52.     int suma = a+b;
  53.     return suma;
  54. }
  55. int f2(int a, int b) {
  56.     int iloczyn = a*b;
  57.     return iloczyn;
  58. }
  59. int f3(int a, int b) {
  60.     int roznica = a-b;
  61.     return roznica;
  62. }
  63. int f4(int a, int b) {
  64.     int iloraz = a/b;
  65.     return iloraz;
  66. }
  67.  
  68. int main() {
  69.     int c,d;
  70.     cout<<"Podaj liczbe 1: ";
  71.     cin>>c;
  72.     cout<<"Podaj liczbe 2: ";
  73.     cin>>d;
  74.     int su = f1(c,d);
  75.     int il = f2(c,d);
  76.     int ro = f3(c,d);
  77.     int ilo = f4(c,d);
  78.     cout<<"Suma wynosi: "<<su<<endl;
  79.     cout<<"Iloczyn wynosi: "<<il<<endl;
  80.     cout<<"Roznica wynosi: "<<ro<<endl;
  81.     cout<<"Iloraz wynosi: "<<ilo<<endl;
  82.     return 0;
  83. }
  84.  
  85. -------------------------------------------------------------------------------------
  86.  
  87. #include <iostream>
  88. #include <ctime>
  89. #include <cstdlib>
  90.  
  91. using namespace std;
  92.  
  93. void generuj(int tab[]) {
  94.     for(int i=0;i<100;i++)
  95.         tab[i] = rand()%21;
  96. }
  97. void pisz(int tab[]) {
  98.     for(int i=0;i<100;i++)
  99.         cout<<tab[i]<<" ";
  100.     }
  101.    
  102. int main() {
  103.     srand(time(0));
  104.     int tab[100];
  105.    
  106.     generuj(tab);
  107.     pisz(tab);
  108.    
  109.     return 0;
  110. }
  111.  
  112. -------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment