K
Kiss31
Почему не компиллируеться следующий код...В чем причина ошибки
#include"stdafx.h"
#include<iostream>
#include<math.h>
double c;
c=double sin(double x);
double area(double a,double b,double c)
{return (a*b*c)/2;}
int main()
{
using namespace std;
double a,b,x;
cout<<"Vitseslenie ploshadi treugolnika:"<<endl;
cout<<"Bvedite storoni treugolnika:"<<endl;
cout<<"Storona a:";
cin>>a;
cout<<"Storona b:";
cin>>b;
cout<<"Ugol:";
cin>>x;
cout<<"Ploshad treugolnika:"<<area(a,b,c)<<endl;
system("pause");
return 0;
}
Выдает следующие ошибки
1>------ Build started: Project: learn2, Configuration: Debug Win32 ------
1> learn2.cpp
1>learn2.cpp(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>learn2.cpp(6): error C2371: 'c' : redefinition; different basic types
1> learn2.cpp(5) : see declaration of 'c'
1>learn2.cpp(6): error C2062: type 'double' unexpected
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#include"stdafx.h"
#include<iostream>
#include<math.h>
double c;
c=double sin(double x);
double area(double a,double b,double c)
{return (a*b*c)/2;}
int main()
{
using namespace std;
double a,b,x;
cout<<"Vitseslenie ploshadi treugolnika:"<<endl;
cout<<"Bvedite storoni treugolnika:"<<endl;
cout<<"Storona a:";
cin>>a;
cout<<"Storona b:";
cin>>b;
cout<<"Ugol:";
cin>>x;
cout<<"Ploshad treugolnika:"<<area(a,b,c)<<endl;
system("pause");
return 0;
}
Выдает следующие ошибки
1>------ Build started: Project: learn2, Configuration: Debug Win32 ------
1> learn2.cpp
1>learn2.cpp(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>learn2.cpp(6): error C2371: 'c' : redefinition; different basic types
1> learn2.cpp(5) : see declaration of 'c'
1>learn2.cpp(6): error C2062: type 'double' unexpected
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========