Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <string>
- #include <ctype.h>
- #include <math.h>
- #include <time.h>
- using namespace std;
- inline float funkcija(int x1, int x2)
- {
- return exp(x1*x2) - pow(x1, 3) + pow(x2, 4) + sqrt(pow(x1, 2) + pow(x2, 2));
- }
- int main(void)
- {
- float p[200], dest[100];
- int dg = -5, gg = 10;
- srand((unsigned)time(NULL));
- for (int i = 0; i < 200; i++)
- p[i] = (float)i; //dg + (float)rand() / RAND_MAX * (gg - dg);
- memcpy(&dest, &p[50], 100*sizeof(float));
- for (int i = 0; i < 100; i++)
- printf("%.2f\n", dest[i]);
- printf("\n======================================== 2. ZADATAK\n\n");
- string str;
- int br = 0;
- do
- {
- printf("Unesite string u rasponu od 8 do 15 slova: ");
- getline(cin, str);
- } while (str.length() < 8 || str.length() > 15);
- size_t found = str.find_first_of("aeiou");
- while (found != std::string::npos)
- {
- br++;
- found = str.find_first_of("aeiou", found + 1);
- }
- printf("Broj samoglasnika u stringu: %d\n", br);
- printf("\n======================================== 3. ZADATAK\n\n");
- int x1 = 0, x2 = 0;
- printf("Unesite x1: ");
- scanf("%d", &x1);
- printf("Unesite x2: ");
- scanf("%d", &x2);
- printf("vrijednost iznosi: %.2f\n", funkcija(x1, x2));
- getchar();
- printf("\n======================================== 4. ZADATAK\n\n");
- string st;
- printf("Unesite string sa brojevima: ");
- getline(cin, st);
- int num = 0;
- for (int i = 0; i<st.size(); i++)
- if (isdigit(st[i])) num++;
- cout << "Broj znamenaka iznosi: " << num << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement