Skip to content

Instantly share code, notes, and snippets.

@earthling-shruti
Created November 20, 2012 02:45
Show Gist options
  • Save earthling-shruti/4115596 to your computer and use it in GitHub Desktop.
Save earthling-shruti/4115596 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <istream>
#include <cstdlib>
#include <math.h>
using namespace std;
int main () {
char c;
int num = 0;
ifstream fin;
fin.open("numbers.txt");
if(fin.good())
{
int count = 0;
while(!fin.eof()){
c = fin.get();
num = 0;
count = 0;
while(c != ' ' && c != '\n' && c!= EOF){
num = num * pow(10, count) + (c-48);
c = fin.get();
count++;
}
cout << "Number:" <<num << endl;
}
fin.close();
}
else{
cout << "blah";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment