Vote count:
0
#include <iostream>
#include <fstream>
using namespace std;
int main() {
int a;
char b;
ifstream in("a.txt");
if (!(in >> a))
in >> b;
if (!(in >> a))
in >> b;
in >> b;
in >> b;
cout << a;
cout << b;
}//source code
5 a b c d e
//a.txt
- If there is a int in the file I want to read it as int and
- If there is a char in the file I want to read it as char.
- why can't read 'char b' after try to read b as int?
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire