I am getting this error:
no operator ">>" matches these operands -- operand types are: std::__1::ifstream >> std::__1::pair<char, int>
when I use pair.
However, after adding #include <string>
from this thread, I still cannot fix this issue.
How can I resolve the error?
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
ifstream fin("test.in");
ofstream fout("test.out");
int n; fin >> n;
pair<char, int> data[1000];
for(int i = 0; i < n; i++) {
fin >> data[i];
}
for(int i = 0; i < n; i++) {
fout << data[i];
}
}
pair
. – Barmarchar
there be treated as a character or as a number? – Swift - Friday Pie