#include #include #include #include float bmiFunktion(float length, float kg, float tot); // Min funktion using namespace std; struct varde{ float kg; float length; float tot; }; int main() { while(true){ string line; ifstream file("texten.txt"); if (file.is_open() ) { while (! file.eof() ) { getline (file, line), cout << line << endl; } file.close(); } else cout << "Kan inte läsa filen texten.txt!"; varde total; cout << "Ange hur lång är du(ange i meter):___\b\b\b"; cin >> total.length; cout << "Ok. Du är " << total.length << " cm lång."<< endl; cout << "Ange din vikt:__\b\b"; cin >> total.kg; bmiFunktion(total.length, total.kg, total.tot); // Sänder variablernas värde till min funktion return 0; } float bmiFunktion(float length, float kg, float tot) { tot = kg / (length * length); // Hit sänds värderna från main och behandlas för att räkna ut BMI cout << "Din längd i tum är: " << length * 100 * 2.54 << "."<< endl; cout << "Din längd i fot är: " << length * 100 * 2.54 / 12 << "."<> temp; system("clear"); if (temp!=0) { break; } } } //bmi.cpp: In function "int main()": //bmi.cpp:46: fel: a function-definition is not allowed here before "{" token