#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <tuple>
void printBoard(std::vector<std::tuple<int,int>> x) {
for (unsigned int i = 0; i < x.size(); i++) {
int trying = std::get<0>(x[i]);
int num = std::get<1>(x[i]);
std::cout << "Case #" << trying << ", Val = $" << num << std::endl;
}
}
int main()
{
std::cout << 5 << std::endl;
}
I tried running this code but I am getting these errors while trying to do so:
DealOrNoDeal.cpp:7:34: error: no member named 'tuple' in namespace 'std'
void printBoard(std::vector<std::tuple<int,int>> x) {
~~~~~^
DealOrNoDeal.cpp:7:43: error: expected '(' for function-style cast or type construction
void printBoard(std::vector<std::tuple<int,int>> x) {
~~~^
DealOrNoDeal.cpp:7:51: error: expected '>'
void printBoard(std::vector<std::tuple<int,int>> x) {
^
DealOrNoDeal.cpp:7:28: note: to match this '<'
void printBoard(std::vector<std::tuple<int,int>> x) {
^
DealOrNoDeal.cpp:7:34: error: no member named 'tuple' in namespace 'std'
void printBoard(std::vector<std::tuple<int,int>> x) {
~~~~~^
DealOrNoDeal.cpp:7:43: error: expected '(' for function-style cast or type construction
void printBoard(std::vector<std::tuple<int,int>> x) {
~~~^
DealOrNoDeal.cpp:7:51: error: expected '>'
void printBoard(std::vector<std::tuple<int,int>> x) {
^
DealOrNoDeal.cpp:7:28: note: to match this '<'
void printBoard(std::vector<std::tuple<int,int>> x) {
^
DealOrNoDeal.cpp:8:34: error: use of undeclared identifier 'x'
for (unsigned int i = 0; i < x.size(); i++) {
^
DealOrNoDeal.cpp:9:34: error: use of undeclared identifier 'x'
int trying = std::get<0>(x[i]);
^
DealOrNoDeal.cpp:10:31: error: use of undeclared identifier 'x'
int num = std::get<1>(x[i]);
Which was really strange because I never had a problem with this code segment before... I am trying to build a deal or no deal game, but all it does is bringing multiple errors. Any ideas on how I can fix this?
Aucun commentaire:
Enregistrer un commentaire