so im a student at California Baptist University and this is my first semester of C++. the professor is teaching everything in visual studios and does not know a single thing about the mac at all. i have not run into any problems until now. she wants us to input a file and it doesn't work for me.
this is my code:
// Program Frame2 reads input values that represent the dimensions
// of a print from a file and calculate the amount of wood needed for
// the frame.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ifstream inFile;
inFile.open("Frame.txt");
int side; // Vertical dimension in inches
int top; // Horizontal dimension in inches
int inchesOfWood; // Inches of wood needed
inFile >> side >> top;
cout << "Dimensions are " << top << " and " << side << "." << endl;
inchesOfWood = top + top + side + side;
cout << "You need " << inchesOfWood << " inches of wood." << endl;
return 0;
}
and this is my output:
Dimensions are 0 and 0.
You need 0 inches of wood.
i verified that the file was in the same exact spot as my code and it still doesn't work.
Someone said to delete this and it would work but i have no idea where to find it:
_GLIBCXX_DEBUG=1 _GLIBCXX_DEBUG_PEDANTIC=1
any suggestions would be great thank you very much
this is my code:
// Program Frame2 reads input values that represent the dimensions
// of a print from a file and calculate the amount of wood needed for
// the frame.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ifstream inFile;
inFile.open("Frame.txt");
int side; // Vertical dimension in inches
int top; // Horizontal dimension in inches
int inchesOfWood; // Inches of wood needed
inFile >> side >> top;
cout << "Dimensions are " << top << " and " << side << "." << endl;
inchesOfWood = top + top + side + side;
cout << "You need " << inchesOfWood << " inches of wood." << endl;
return 0;
}
and this is my output:
Dimensions are 0 and 0.
You need 0 inches of wood.
i verified that the file was in the same exact spot as my code and it still doesn't work.
Someone said to delete this and it would work but i have no idea where to find it:
_GLIBCXX_DEBUG=1 _GLIBCXX_DEBUG_PEDANTIC=1
any suggestions would be great thank you very much