#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
string no, firstin, lastin, weight, height;
ifstream inFile;
inFile.open("homework.txt");
std::cout << std::setw(13) << std::setfill(' ') << "NO"
<< std::setw(13) << std::setfill(' ') << "FIRSTIN"
<< std::setw(13) << std::setfill(' ') <<"LASTIN"
<< std::setw(13) << std::setfill(' ') << "WEIGHT"
<< std::setw(13) << std::setfill(' ') << "HEIGHT"
<< std::setw(13) << std::setfill(' ') <<"BMI" <<std::endl;
if (inFile.is_open())
{
//correct this for reading upto '\n'
while (getline(inFile, no, '#'),
getline(inFile, firstin, '#'),
getline(inFile, lastin, '#'),
getline(inFile, weight, '#'),
getline(inFile, height, '\n') //read upto '\n' instead of '#'
)
{
std::cout << std::setw(13) << std::setfill(' ') << no
<< std::setw(13) << std::setfill(' ') << firstin
<< std::setw(13) << std::setfill(' ') <<lastin
<< std::setw(13) << std::setfill(' ') << weight
<< std::setw(13) << std::setfill(' ') << height
<< std::setw(13) << std::setfill(' ') << "BMI" //write whatever bmi value here
<<std::endl;
}
}
inFile.close();
return 0;
}
1#Hannah#Cruz#130#5'4
2#Franches#Ramire#137#5'6