Tomorrow its due and i just hit a road block

So my name is Abel and i have a pretty simple problem.....hopefully. I am running visual basic for a c++ class that i am taking in college. The assignment is the usual, convert centimeters to yards, feet, inches. Well i have a .dat file holding the centimeters she listed, a .out for the output file, and .cpp for the code. The problem is that i refresh the code even taking things out and my .out file doesn't reflect what i changed. I have the basics of variables and constants and have the pseudocode to complete but i cant get the outfile to reflect the code since the first revision. PLEASE HELP!!!! here is the code


[code]#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;

void main()
{
int centimeter;

ifstream inf;
inf.open("sanchezprog1.dat");
ofstream outf;
outf.open("sanchezprog1.dat");

{
inf >> centimeter, i;
outf << "Centimeter = " << centimeter << endl;
}
}/code]
Last edited on
don't use 2 seperate streams to read the same file, you can do this but you must make sure you close() the current stream before trying to open with another.
Topic archived. No new replies allowed.