Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<string.h>
- using namespace std;
- string s;
- int read_data()
- {
- fstream f;
- f.open("input.dat",ios::in);
- f>>s;
- f.close();
- }
- int main()
- {
- read_data();
- int counter=0;
- while (s[counter]!='\0') { counter++; }
- int result=0;
- for(int i=0;i<counter;i++)
- {
- int value;
- if ((int)s[i]==48) value=0;
- if ((int)s[i]==49) value=1;
- if ((int)s[i]==50) value=2;
- result=result*10+value;
- }
- cout<<result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement