#1 2011-01-26 14:40:40

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

10 listopada 2010

zad.1.
oblicza i wypisuje pole kwadratu.

zad.2.
oblicza i wypisuje pole trójkąta.

zad.3.
oblicza i wypisuje sumę 3 liczb a,b,c spełniających warunki:
a>10, b<100, c!=20.
if((a>10)&&(b<100)&&(c!=20))

zad.4.
Oblicza sumę 3 dowolnych liczb: a, b, c.
Jeżeli suma>500 komunikat "Duża suma", w przeciwnym wypadku komunikat "Mała suma".

zad5.
Oblicza i wypisuje średnią 5 liczb: a, b, c, d, e spełniających warunki:
a>0,b>0,c>0,d>100 lub d<200, e!=d

Offline

 

#2 2011-01-27 14:56:10

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

Re: 10 listopada 2010

/*
zad.1.
Program obliczający i wypisujący pole kwadratu.
*/

#include<iostream.h>
int main()
{
int a,pole;
cout<<"podaj bok kwadratu"<<endl;
cin>>a;
cout<<endl;
if(a>0)
  {
  pole=a*a;
  cout<<"pole wynosi : "<<pole<<endl;
  }
else
  {
  cout<<"a<0"<<endl;
  }
system("pause");
}

Offline

 

#3 2011-01-27 14:58:55

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

Re: 10 listopada 2010

/*
zad.1.wersja.1.
Program obliczający i wypisujący pole trójkąta.
*/

#include<iostream.h>
int main()
{
int a,h;
float pole;
cout<<"podaj podstawe a"<<endl;
cin>>a;
if(a>0)
  {
  cout<<"podaj wysokość h"<<endl;
  cin>>h;
  if(h>0)
    {
    pole=(a*h)/2;
    cout<<"pole: "<<pole<<endl;
    }
  else
    {
    cout<<"h<0"<<endl;
    }
  }
else
  {
  cout<<"a<0"<<endl;
  }
system("pause");
}


/*
zad.1.wersja.2.
Program obliczający i wypisujący pole trójkąta, wersja 2.
*/

#include<iostream.h>
int main()
{
int a,h;
float pole;
cout<<"podaj a i h "<<endl;
cin>>a>>h;
if((a>0)&&(h>0))
  {
  pole=(a*h)/2;
  cout<<"pole : "<<pole<<endl;
  }
else
  {
  cout<<"a h <0"<<endl;
  }
system("pause");
}

Offline

 

#4 2011-01-27 15:01:10

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

Re: 10 listopada 2010

/*
zad.3.
Program obliczający i wypisujący sumę 3 liczb a,b,c spełniających warunki:
a>10, b<100, c!=20.
*/

#include<iostream.h>
int main()
{
int a,b,c,suma;
cout<<"podaj a, b, c "<<endl;
cin>>a>>b>>c;
if((a>10)&&(b<100)&&(c!=20))
  {
  suma=a+b+c;
  cout<<"suma : "<<suma<<endl;
  }
else
  {
  cout<<"a<10, b>100, c==20"<<endl;
  }
system("pause");
}

Offline

 

#5 2011-01-27 15:02:15

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

Re: 10 listopada 2010

/*
zad.4.
Program obliczający sumę 3 dowolnych liczb: a, b, c.
Jeżeli suma>500 komunikat "Duża suma", w przeciwnym wypadku komunikat "Mała suma".
*/

#include<iostream.h>
int main()
{
int a,b,c,suma;
cout<<"podaj a, b, c "<<endl;
cin>>a>>b>>c;
suma=a+b+c;
if(suma>500)
  {
  cout<<"Duża suma"<<endl;
  }
else
  {
  cout<<"Mała suma"<<endl;
  }
system("pause");
}

Offline

 

#6 2011-01-27 15:03:18

 pszonka

Administrator

1708501
Zarejestrowany: 2011-01-25
Posty: 113
Punktów :   

Re: 10 listopada 2010

/*
zad.5.
Program obliczający i wypisujący średnią 5 liczb:a,b,c,d,e spełniających warunki:
a>0,b>0,c>0,d>100 lub d<200, e!=d
*/

#include<iostream.h>
int main()
{
int a,b,c,d,e;
float srednia;
cout<<"podaj a, b, c, d, e"<<endl;
cin>>a>>b>>c>>d>>e;
if((a>0)&&(b>0)&&(c>0)&&(d>100)||(d<200)&&(e!=d))
  {
  srednia=(a+b+c+d+e)/5;
  cout<<"Średnia wynosi :"<<srednia<<endl;
  }
else
  {
  cout<<"Nieprawidłowo podane liczby"<<endl;
  }
system("pause");
}

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi

[ Generated in 0.079 seconds, 10 queries executed ]


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.sid.pun.pl www.merkury.pun.pl www.german2008.pun.pl www.narutoxgra.pun.pl www.green-iris.pun.pl