#include <iostream.h> //
#include <iomanip.h>
#include <conio.h>
using namespace std;
using namespace std;
main()
{
float a, b, pole;
cout << "Program oblicza pole prostokata." << endl;
cout << "Podaj bok a." << endl;
cin >> a;
cout << "Podaj bok b." << endl;
cin >> b;
pole = a*b;
2.
#include <iostream>
#include <iomanip>
#include <math.h>
#include <conio.h>
using namespace std;
main()
{
float r, objetosc;
cout << "Program oblicza objetosc kuli o promieniu r." << endl;
cout << "Podaj promien r." << endl;
cin >> r;
objetosc = 4*M_PI*r*r*r/3;
cout << fixed;
cout << setprecision(2);
cout << "Objetosc kuli o promieniu r = " << r << " wynosi ";
cout << objetosc << "." << endl;
getch(); //
}
3.
#include <iostream.h> //
#include <conio.h>
using namespace std;
using namespace std;
main()
{
int a = 37;
int b = 11;
cout << "Program oblicza wynik dzielenia calkowitego" << endl;
cout << "dla dwoch liczb calkowitych." << endl;
cout << "Dla liczb a = " << a << " i b = " << b << endl;
cout << a << "/" << b << " = " << a/b << "." << endl;
getch();
}
4.
#include <iostream>
#include <conio.h>
using namespace std;
main()
{
int a = 37;
int b = 11;
cout << "Program oblicza reszte z dzielenia calkowitego";
cout << " dwoch liczb calkowitych." << endl;
cout << "Dla liczb a = " << a << " i b = " << b << endl;
cout << a << "%" << b << " = " << a%b << "." << endl;
getch();
}
5.
##include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
main()
{
float x, y, suma, roznica, iloczyn, iloraz;
cout << "Program oblicza sume, roznice, iloczyn i iloraz" << endl;
cout << "dla dwoch liczb x i y wprowadzanych z klawiatury." << endl;
cout << endl;
cout << "Podaj x." << endl;
cin >> x;
cout << "Podaj y." << endl;
cin >> y;
suma = x+y;
roznica = x-y;
iloczyn = x*y;
iloraz = x/y;
cout << fixed;
cout << setprecision (2);
cout << "Dla x = " << x << " i y = " << y << endl;
cout << endl;
cout << "suma = " << suma << "," << endl;
cout << "roznica = " << roznica << "," << endl;
cout << "iloczyn = " << iloczyn << "," << endl;
cout << "iloraz = " << iloraz << ".";
getch();
}
#include <iomanip>
#include <conio.h>
using namespace std;
main()
{
float x, y, suma, roznica, iloczyn, iloraz;
cout << "Program oblicza sume, roznice, iloczyn i iloraz" << endl;
cout << "dla dwoch liczb x i y wprowadzanych z klawiatury." << endl;
cout << endl;
cout << "Podaj x." << endl;
cin >> x;
cout << "Podaj y." << endl;
cin >> y;
suma = x+y;
roznica = x-y;
iloczyn = x*y;
iloraz = x/y;
cout << fixed;
cout << setprecision (2);
cout << "Dla x = " << x << " i y = " << y << endl;
cout << endl;
cout << "suma = " << suma << "," << endl;
cout << "roznica = " << roznica << "," << endl;
cout << "iloczyn = " << iloczyn << "," << endl;
cout << "iloraz = " << iloraz << ".";
getch();
}
Brak komentarzy:
Prześlij komentarz