Why is this infinitely looping?
This is my input.txt verbatim:
sin 45 cos 45 tan 45
Aren't sin, cos, and tan supposed to be stored in the oper string but I have a feeling like they aren't or at least only sine is?
This is basically supposed to be a simple taking of the angle and outputting the answer. The inputs are contained in input.txt and the answer is outputted in an organized output.txt.
This is my header file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using std::string;
using std::istream;
using std::ostream;
using std::setprecision;
using std::fixed;
using std::showpoint;
using std::setw;
void calculate( string inputfilename, string outputfilename );
Line 38: If the last in >> operation was successful, you're going to loop forever since you do not access cin inside the loop, therefore the status of cin never changes.
If you intended the program to loop, move the while statement to after line 35.
If you did not intend the program to loop, change the while to if.