Making a calculator program.

So i was wondering if their is a way that you can make your program read a file and read all the numbers in the file and plug it in your formula. And output the answers.(any related articles that you can point me towards would be appreciated.)
http://www.cplusplus.com/doc/tutorial/files/

You will want a simple input loop:
1
2
3
4
5
6
7
8
{
    int x;
    std::ifstream in ("input.txt");
    while(in >> x)
    {
        //do calculation
    }
}
The outermost braces are intentional.
Last edited on
Topic archived. No new replies allowed.