Facebook
From Colossal Baboon, 7 Years ago, written in C++.
This paste is a reply to Re: Re: Untitled from Burly Goose - view diff
Embed
Download Paste or View Raw
Hits: 510
  1. Zad.2 laborki 10
  2.  
  3. #include<stdlib.h>
  4. #include<ctime>
  5. #include<iostream>
  6. using namespace std;
  7.  
  8. void d(int *t,int s)
  9. {
  10.         int p=0;
  11.         for(int i=0;i<100;i++)
  12.         {
  13.         if(p<t[i]&& t[i]<s) //&& => "i"
  14.         {
  15.                 p=t[i];
  16.         }
  17. }
  18. cout<<p;
  19. }
  20.  
  21. int main()
  22. {
  23.         int s=0;
  24.         int t[100];
  25.         for(int i=0;i<100;i++)
  26.         {
  27.                 t[i]=rand() % 1001; //losowanie od 0 do 1000
  28.                 if(t[i]>s)
  29.                 {
  30.                         s=t[i];
  31.                 }
  32.         }
  33.         cout<<"nawieksza liczba to "<<s<<" a druga najwieksza to "<<endl;
  34.         d(t,s);
  35.         return 0;
  36. }
  37.  

Replies to Re: Re: Re: Untitled rss

Title Name Language When
Re: Re: Re: Re: Untitled Coral Water Vole cpp 7 Years ago.