Erreur de compilateur “constante de caractère trop long pour son type”. Quel est le problème?

J'ai un code que je suis en train de travailler sur...

#include <iostream>
#include <string>

int main()
{
  std::cout << "Hello. Welcome to Delicious Drive Up. What would you like to order?\n";
  std::cout << "\nOur menu is-";
  std::cout << "...";
  std::cout << "\nOrder here > ";
  std::string choice;
  std::getline(cin, choice);
  if (choice == 'hamburger' || choice == 'Hamburger')
  {
      std::cout << "We don't have any ham. Is a Chickenburger all right? y/n. > ";
      std::string opt;
      std::getline(cin, opt);
      if (opt == 'y' || opt == 'Y' || opt == 'yes' || opt = 'Yes')
      {
          std::cout << "Here's your chickenburger.";
      }
  }
}

Cela a été adapté à partir d'un script Bash que j'ai écrit et est l'un de mes premiers programmes C++. Quand je compile ce, il est livré avec de ces erreurs...

test.cpp:19:15: warning: character constant too long for its type
test.cpp:19:40: warning: character constant too long for its type
test.cpp:23:44: warning: multi-character character constant
test.cpp:23:59: warning: multi-character character constant
test.cpp: In function int main()’:
test.cpp:19: error: no match for operator==’ in choice == 1919378802
test.cpp:19: error: no match for operator==’ in choice == 1919378802
test.cpp:23: error: no match for operator==’ in opt == 'y'
test.cpp:23: error: no match for operator==’ in opt == 'Y'
test.cpp:23: error: no match for operator==’ in opt == 7955827

Pourriez-vous expliquer ce que cela signifie et comment les corriger?

EDIT: je reçois un nouveau message d'erreur maintenant...

.test.cpp: In function int main()’:
.test.cpp:23: error: no match for operator||’ in ‘((std::operator== [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(& opt))), ((const char*)"y")) || std::operator== [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(& opt))), ((const char*)"Y"))) || std::operator== [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(& opt))), ((const char*)"yes"))) || opt
.test.cpp:23: note: candidates are: operator||(bool, bool) <built-in>
Juste pour éclaircir un point, le C++ n'est pas un langage de script, donc ce n'est pas réellement un script.
Les erreurs seraient plus utiles si nous savions en fait, la ligne 19 est, etc. Il ne semble pas à l'égalité des numéros de ligne dans le code ce qui m'amène à l'hypothèse que vous avez modifié le code avant de le poster?
Pourriez-vous expliquer? Aussi, je n'ai pas dis que c'était. J'ai dit que c'était un programme. Est-ce mal?
Vous ne savez pas que les hamburgers ne sont pas fabriqués à partir de jambon, droit ? Le nom vient de la ville de Hambourg, en Allemagne.
Oui je le fais. 🙂

OriginalL'auteur CoffeeRain | 2012-02-03