[ create a new paste ] login | about

Link: http://codepad.org/Kxo3fXMR    [ raw code | output | fork ]

C++, pasted on Dec 20:
#include <iostream>
//#include <cmath>
//#include <locale>
void c511();
void c521();
void c5211();
int main() {
    int k;
    //setlocale( LC_ALL,"Russian");
    std::cout<<"выберите лабораторную :" <<std::endl;
    std::cout<<"1 - C5.1.1" <<std::endl;
    std::cout<<"2 - C5.2.1" <<std::endl;
    std::cout<<"3 - C5.2.11" <<std::endl;
    std::cin >> k;
        if (k==1){c511();}
    if (k==2){c521();}
    if (k==3){c5211();}
}
void c511() {
using namespace std;
double x=2.35;
double a=0.89;
double b=2.065;
double y;
y=pow(x,(a+b));
std::cout <<"y= " << y << std::endl;}
void c521() {
using namespace std;
double x;
double y;
double z;
std::cout<<"vvedite x"<<std::endl;
std::cout<<"vvedite y"<<std::endl;
std::cin >> x;
std::cin >> y;
if(x>0){z=x-y;}
else {z=y-x+1;}
std::cout << "z= "<<y << std::endl;
std::cin >> x;
}
void c5211() {
using namespace std;
double a;
double b;
double c;
double d;
double kol = 4;
std::cout << "vvedite a"<<std::endl;
std::cin >> a;
std::cout << "vvedite b"<<std::endl;
std::cin >> b;
std::cout << "vvedite c"<<std::endl;
std::cin >> c;
std::cout << "vvedite d"<<std::endl;
std::cin >> d;
if(a <= 0) {--kol;}
if(b <= 0) {--kol;}
if(c <= 0) {--kol;}
if(d <= 0) {--kol;}
if(kol == 0) {return 0;}
double summ = 0;
if(a > 0) {summ += a;}
if(b > 0) {summ += b;}
if(c > 0) {summ += c;}
if(d > 0) {summ += d;}
 cout << summ / kol;
}


Output:
1
2
3
In function 'void c5211()':
Line 60: error: return-statement with a value, in function returning 'void'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: