Linking problems
It cant find the declarations of the functions i want to use, althoug h they are all there.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <iostream>
#include "kera.h"
using namespace std;
void tutvustus_kera(){
int x;
cout << "MIllist kera parameetirt soovite leida?" << endl;
cout << "1. Ruumala raadiuse kaudu" << endl;
cout << "2. Ruumala umbermoodu kaudu" << endl;
cout << "3. Ruumala pindala kaudu" << endl;
cout << "4. Pindala raadiuse kaudu" << endl;
cout << "5. Pindala umbermoodu kaudu" << endl;
cout << "6. Pindala ruumala kaudu" << endl;
cin >> x;
}
void valik(int x){
double umbermoot, raadius, diameeter, pindala, ruumala;
switch(x){
case 1:
cout << "Sisestage raadius: ";
cin >> raadius;
cout << "Ruumala on " << ruumala_raadius(raadius) << endl;
break;
case 2:
cout << "Sisestage umbermoot: ";
cin >> umbermoot;
cout << "Ruumala on " << ruumala_umbermoot(umbermoot) << endl;
break;
case 3:
cout << "Sisestage pindala: ";
cin >> pindala;
cout << "Ruumala on " << ruumala_pindala(pindala) << endl;
break;
case 4:
cout << "Sisestage raadius: ";
cin >> raadius;
cout << "Pindala on " << pindala_raadius_kera(raadius) << endl;
break;
case 5:
cout << "Sisestage umbermoot: ";
cin >> umbermoot;
cout << "Pindala on " << pindala_umbermoot_kera(umbermoot) << endl;
break;
case 6:
cout << "Sisestage ruumala: ";
cin >> ruumala;
cout << "Pindala on " << pindala_ruumala(ruumala) << endl;
break;
case 7:
cout << "Sisestage pindala: ";
cin >> pindala;
cout << "Umbermoot on " << umbermoot_pindala(pindala) << endl;
break;
}
}
|
Dont mind case 7.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#ifndef KERA_H_INCLUDED
#define KERA_H_INCLUDED
void valik(int x);
void tutvustus_kera(void);
double ruumala_raadius(double raadius);
double pindala_raadius_kera(double raadius);
double ruumala_umbermoot(double umbermoot);
double pindala_umbermoot_kera(double umbermoot);
double ruumala_pindala(double pindala);
double pindala_ruumala(double ruumala);
#endif // KERA_H_INCLUDED
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <math.h>
#include "uhis.h"
#include "kera.h"
using namespace std;
#define pi 3.14
double ruumala_raadius(double raadius){
return 4 * pi * pow(raadius, 3) / 3;
}
double pindala_raadius_kera(double raadius){
return 4 * pindala_raadius(raadius);
}
double ruumala_umbermoot(double umbermoot){
return ruumala_raadius(raadius_umbermoot(umbermoot));
}
double pindala_umbermoot_kera(double umbermoot){
return pindala_raadius_kera(raadius_umbermoot(umbermoot));
}
double ruumala_pindala(double pindala){
return ruumala_raadius(sqrt(pindala / (4 * pi)));
}
double pindala_ruumala(double ruumala){
return pindala_raadius_kera(pow((3 * ruumala)/ (4 * pi), 1/3));
}
|
So what could be the problem??
Topic archived. No new replies allowed.