-4

Im trying to put data into an array

#include <iostream>
#include <stdio.h>
#include <cstring>

using namespace std;

struct table {
    int number;
    double  rate, hour;
    string name;
} test[5];

int main()
{
    test[0]={2,0.0,1.1,'m'};
    test[1]={2,0.0,1.1,'m'};
   
   return 0;
}

I know the syntax is wrong for this test[0]={2,0.0,1.1,'m'};. please correct it.

SuperStormer
  • 4,997
  • 5
  • 25
  • 35
The
  • 13
  • 3

1 Answers1

0

You have the wrong type of quotes: 'm' is a char but you need a std::string. Change it to "m" and your code compiles.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436