All pastes #915782 Raw Edit

Mine

public cpp v1 · immutable
#915782 ·published 2008-02-24 01:26 UTC
rendered paste body
#include <iostream>#include <cstdlib>#include <fstream>#include <string>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 << "."<<endl;		cout << "Din vikt i pund är: " << kg * 2.2 << "."<< endl;		cout << "Ditt BMI-värde är: " << tot << "\n"; // Output här          		int temp = 0;cout << "----------------------------------------------\n";cout << "Vad vill du göra nu? (0: Fortsätta, 1: Avsluta)\n";cout << "----------------------------------------------\n";cin >> 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