voici le code
il fonctionne avec borlanc c++
#include<iostream.h>
#include<math.h>
int a;
int b;
int c;
float delta;
int main()
{
cout<<"calcul de racines d'equations du 2nd degre : aX^2+bX+c = 0\n";
cout<<"entrez a\n";
cin>>a;
cout<<"entrez b\n";
cin>>b;
cout<<"entrez c\n";
cin>>c;
delta = b*b-4*a*c;
if (delta>0) {
cout<<"2 racines\n";
cout<<"premiere racine: "<<(-b-sqrt(delta))/2<<"\n";
cout<<"deuxieme racine: "<<(-b+sqrt(delta))/2<<"\n";
}
else if (delta == 0) { cout<<"racines double: "<< -b/2;}
else { cout<<"pas de raciens reelles";}
}
lorsque je fais gcc racines, j'ai les erreurs suivantes
linuxhome/marc # gcc racines.cpp
/tmp/ccqZp2dW.o: In function `main':
/tmp/ccqZp2dW.o(.text+0xf): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x14): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x24): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x29): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x39): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x3e): undefined reference to `istream::operator>>(int &)'
/tmp/ccqZp2dW.o(.text+0x4e): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x53): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x63): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x68): undefined reference to `istream::operator>>(int &)'
/tmp/ccqZp2dW.o(.text+0x78): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x7d): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x8d): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x92): undefined reference to `istream::operator>>(int &)'
/tmp/ccqZp2dW.o(.text+0xec): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0xf1): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x123): undefined reference to `sqrt'
/tmp/ccqZp2dW.o(.text+0x146): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x14b): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x156): undefined reference to `ostream::operator<<(double)'
/tmp/ccqZp2dW.o(.text+0x161): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x193): undefined reference to `sqrt'
/tmp/ccqZp2dW.o(.text+0x1b6): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x1bb): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x1c6): undefined reference to `ostream::operator<<(double)'
/tmp/ccqZp2dW.o(.text+0x1d1): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x215): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x21a): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x225): undefined reference to `ostream::operator<<(int)'
/tmp/ccqZp2dW.o(.text+0x239): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x23e): undefined reference to `ostream::operator<<(char const *)'
collect2: ld returned 1 exit status
linuxhome/marc #