Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <ostream>
- #include <windows.h>
- /*
- Letter (Letter | Digit)*
- */
- using namespace std;
- int main()
- {
- fstream text("D:\\text.txt");
- if (!text)
- {
- cout << "Error!\n";
- exit(-1);
- }
- char in;
- string var_name;
- in = text.get();
- cout << "in = " << in << endl;
- if (isalpha(in))
- {
- var_name += in;
- cout << "var_name = " << var_name << endl;
- }
- else
- {
- cout << "Error!\n";
- exit(-1);
- }
- in = text.get();
- cout << "second in = " << in << endl;
- while ((isalpha(in) || isdigit(in)) && (!text.eof()))
- {
- var_name += in;
- in = text.get();
- cout << "\nin = " << in;
- }
- cout << "\nvar_name = " << var_name << endl;
- text.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement