1
I have a function Show()
which traverses a list and should display it on the screen, but I cannot concatenate the value of a list with a string.
Follows code:
#include "pch.h"
#include <iostream>
#include <string>
#define MAX 5
typedef struct {
string Nome;
double Salario;
} Funcionario;
typedef struct {
Funcionario Funcionarios[MAX];
int Inicio, Fim;
} Lista;
void Show(Lista *Lista) {
for (int i = 0; i < Lista->Fim; i++) {
cout << "Func.: " << Lista->Funcionarios[i].Nome;
cout << "Salário: " << Lista->Funcionarios[i].Salario;
}
}
The problem is in
cout << "Func.: " << Lista->Funcionarios[i].Nome;
where I can’t do the cout
.
I have the following mistake
E0349 no "<<" operator corresponds to these operands the types of operands are: Std::basic_ostream> << Std::string
Made the call
using namespace std;
? In case I didn’t, yourscout
must bestd::cout
.– bruno101
Yes I had already done.
– Augusto Henrique