Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- #include<stdio.h>
- using namespace std;
- int main()
- {
- int n=0;
- double temp=0;
- double P;
- double suma=0;
- double ile=0;
- cout<<"Podaj ile liczb chcesz wpisac do tablicy: "<<endl;
- cin>>n;
- while (n<=0||n>200)
- {
- cout<<"Podaj ile liczb chcesz wpisac do tablicy: ";
- cin>>n;
- }
- double *tab = new double[n];
- cout<<"Wpisz liczby z zakresu <0;100>"<<endl;
- for (int i=0;i<n;i++)
- {
- double temp;
- cout<<"Podaj "<<i+1<<" liczbe: ";
- cin>>temp;
- while (temp>100 || temp<0)
- {
- cout<<"Podaj "<<i+1<<" liczbe: ";
- cin>>temp;
- }
- tab[i]=temp;
- }
- cout<<endl;
- cout<<"Podaj wartosc P:"<<endl;
- A1: cin>>P;
- if (P<0)
- {
- cout << "Podales zla wartosc P. Podaj poprawna P>0:" <<endl;
- goto A1;
- }
- cout<<"Liczby wieksze od P: "<<endl;
- for (int i=0;i<n;i++)
- {
- suma += temp;
- ile++;
- if (tab[i]>P)
- {
- cout<<tab[i]<<endl;
- }
- }
- cout<<"Srednia z tych liczb:"<< suma / ile <<endl;
- cout<<endl;
- delete []tab;
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment