Code Fix

初級error: no match for 'operator>>' の原因と直し方 › パターン1

error: no match for 'operator>>' の原因と直し方

std::cout に >> を使ったり、std::cin に << を使ったりと、ストリーム演算子の向きを取り違えたときに出るエラーです。

 1  #include <iostream>
 2  int main() {
 3      int score = 90;
 4      std::cout __ score;
                   ^
 5      return 0;
 6  }
main.cpp:4:15: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')

空欄を埋めてコンパイル・実行を通す

広告
広告スロット(未設定)

error: no match for 'operator>>' の原因と直し方

<<は出力(送り込む)、>>は入力(受け取る)で向きが逆です。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)