fik jeg sagt det stadigvæk ikke virker ? *s*
Måske:
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
ifstream infile("beregninger.txt");
if(!infile)
{
cerr << "Failed to open infile" << endl;
return 0;
}
unsigned int Hour, Min, Sec;
infile >> Hour;
infile >> Min;
infile >> Sec;
cout << "Before: "<< Hour << " " << Min << " " << Sec << " " << endl;
// Do something to time
Sec += 12;
if(Sec >= 60)
{
Min++;
Sec -= 60;
}
Min += 12;
if(Min >= 60)
{
Hour++;
Min -= 60;
}
Hour = (Hour + 12)%24;
cout << "After " << Hour << " " << Min << " " << Sec << " " << endl;
ofstream outfile("resultat.txt");
if(!outfile)
{
cerr << "Failed to open output" << endl;
return 0;
}
outfile << Hour << " " << Min << " " << Sec << " " << endl;
return 0;
}