Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Plebeian Tier Question

Name: Anonymous 2012-04-30 19:39

First semester CS major here - I was absent from class once a while back and now that we're referencing the material I missed, I'm a little clueless. I have no friends so I figured I'd ask you guys.

Basically put, I'm having a little trouble how ifstream objects work. Before this segment of code, I've successfully opened a file and assigned it to ifstream variable "infile," but I don't know how I'm supposed to use it.

for (i = 1; i<= 3; i++)
{
    getInputs (infile, l, w);
    a = getArea (l, w);
    displayArea (l, w, a);
}

I'm fine with the functions displayArea and getArea, but this is what I'm working off of with getInputs and I'm a little stumped.

getInputs (ifstream& inputFile, double& length, double& width)
{
    inputFile >> length >> width;
}

I realize this fragment is probably retarded but I'm clueless - I'd appreciate any help you can give me.

Name: Anonymous 2012-05-01 12:42

[quote]ifstream[/quote]
Stopped reading right there.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List