Ifstream help ASAP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bsnpr8
    New Member
    • Sep 2006
    • 3

    #1

    Ifstream help ASAP

    Hi, have to make a program that read a document in the same folder that i created it and i need to use ifstream to print the other program information, i have done this already:

    #include "stdafx.h"
    #include <iostream>
    #include <iomanip>
    #include <fstream>

    #include<tchar. h>

    using namespace std;

    void main()
    {

    char continuar = 0;
    char FirstName[15];

    do{

    cout<<"Enter the name of the file you are looking for (Write .txt at the end of the name): ";
    cin>>FirstName;

    ifstream resultados;
    resultados.open (FirstName, ios::in);

    cout<<"Do you want to continue?(y = yes, n = no)"<<endl;
    cin>>continuar;

    }while(continua r == 'y');

    cout<<"Program Terminated"<<en dl;
    }

    What i want to do is print the information on the program. Here is an example what i have to print.

    Name: Bryan.txt
    Amount entered: $1500
    Year Amount
    Year1 1575
    Year2 1653.75
    Year3 1736.44
    Year4 1823.26
    Year5 1914.42
    Year6 2010.14
    Year7 2110.65
    Year8 2216.18
    Year9 2326.99
    Year10 2443.34

    Please help me out i need it for tuesday in the morning, thanks
Working...