Adding two numbers as strings from a textfile I just implemented code to add two ints together as strings and I'm sure my method is inferior. I've looked up other methods too but I'd appreciate criticisms specific to my code. I really want to make sure I don't develop bad habits in C++ and I think leveraging the knowledge of brighter individuals than myself on this site will help with that :).
Am I relying too much on iterators btw?

Anyhow, the code is below and be as harsh as you want. Thanks!

//This program intends to read very large integers from a text file
//the format is two integers per line. It will then add them together and output
//the sums one each line

//first, succesfully read from the text file and store into two vectors
//each digit being an element
#include&lt;iostream&gt;
#include&lt;fstream&gt;
#include&lt;string&gt;
#include&lt;vector&gt;
using namespace std;

int main()
{

    string line,s1,s2;
    vector&lt;string&gt; vec1, vec2; //string 1 and string 2 store each of the 2 numbers per line as individual digits
    vector&lt;string&gt; final;      //create vector of strings that holds the sum of each pair of strings per line
    ifstream myfile("bignum.txt"); //this opens the file bignum.txt
    if (myfile.is_open())
    {
       int  count=0; //count lines
       while (!myfile.eof())
       {
           getline(myfile,line);
           bool flag=true; //bool to see if integer 2 should be stored now
           for (int i=0; i&lt;line.length(); i++)
           {
               if (line[i]==' ')
                   flag=false;
               else
               {
                   if (flag)
                       s1+=line[i];
                   else
                       s2+=line[i];
               }


                //by the end of this loop we have two strings representing each of the numbers
           }

           //will now append 0's to the front of the smaller string in order to make the strings the same length
          if (s1.length()&lt;s2.length())
              s1=string(s2.length()-s1.length(),'0')+s1;
          else
              s2=string(s1.length()-s2.length(),'0')+s2;

           //create a variable that acts as the surplus/carry for each single-digit addition
           int carry=0;           

           //create iterators allowing for iteration over a vector
           string::reverse_iterator it1 = s1.rbegin(),it2=s2.rbegin();
           string sum_string="";

           for (; it1!=s1.rend(); it1++, it2++)
           {
               //convert chars to ints
               int k1=*it1-'0';
               int k2=*it2-'0';

               //intermediate sum
               int sum_inter=k1+k2+carry;
               carry=0;

               sum_string.insert(0,to_string(sum_inter%10)); 
               carry+=int((sum_inter-sum_inter%10)/10);

           };

           //insert the last carry into the highest digit position
           sum_string.insert(0,to_string(carry));

           //go through sum_string and omit leading 0's
           bool lead_zero=true;
           string::iterator leadit=sum_string.begin();
           while(lead_zero)
           {
               if (int(*leadit-'0')==0)
                  sum_string.erase(0,1);
               else
                 lead_zero=false;
           }

           final.push_back(sum_string);

           //clear strings 1 and 2 for reuse

           s1.clear();
           s2.clear();
       }

        vector&lt;string&gt;::iterator i1=final.begin();
        int count3=0;
        for (; i1!=final.end(); i1++)
        {
            count3++;
            cout&lt;&lt;"The sum of the numbers on line "&lt;&lt;count3&lt;&lt;" is "&lt;&lt;*i1&lt;&lt;"\n";
        }

    }
    else cout &lt;&lt;"file could not be opened";
    return 0;
}
Some basic C++ advice:


Don't use using namespace std;. It leads to namespace pollution: it you use another library, you may import names in the global namespace that may clash with those in the std namespace. Anyway, adding std:: in front of the standard library components does not hinder readability.
return 0; at the end of main is useless. If the program reaches the end of main without having encountered any return statement, it will automagically return 0.
You compare signed and unsigned integer values in this line:

for (int i=0; i&lt;line.length(); i++)


That means that you didn't turn on the right compiler flags (-Wall, -pedantic and -Wextra flags that you should almost always use) or that you ignored the warnings. Try never to ignore warnings, they help to write good code. To fix this warning, simply turn int i=0 into std::size_t i=0. Ideally, you should even write typename std::string::size_type i=0 but people generally agree that it is too long, and the main standard library implementations use std::size_t anyway for the length of a string.

The rationale for this warning is that in some cases, the comparison will happen, but small negative integers may be compared to big unsigned integers. On theo ther hand, if you compare unsigned integers with different sizes, you will never have such a problem.
It's really no more than a tidbit, but post-incrementation (++i) may be faster than pre-incrementation (i++). We all know that premature optimization is the root of all evils, but this one is simple enough to write as you go. In other words, you should remember this useful guideline:


  Use ++i if you don't have a specific reason to use i++.

The variable count is never used, you can remove it. You compiler should have told you that it was unused.
Try to organize your headers in alphabetical order:

#include&lt;fstream&gt;
#include&lt;iotream&gt;
#include&lt;string&gt;
#include&lt;vector&gt;


It will help you when you want to check whether a header is already included or not.
If you want to check whether an ifstream was successfully openen, don't use is_open, use operator!:

ifstream myfile("bignum.txt"); //this opens the file bignum.txt
if (not myfile)
{
    // An error occured
    // handle the error
}
// else use myfile

Also, this it not the idiomatic way to read a file line by line:

while (!myfile.eof())
{
    getline(myfile,line);
    // ...
}


Here is how you should do it, std::getline has been designed to be used in such a loop:

while (getline(myfile, line))
{
    // ...
}


Actually, using eof can read past end of file which makes it unsafe to read a file line by line until the end of the file is reached.