Witam!
Męczę się z komunikatem pod tytułem "error: scalar object 'Snames' requires one element in initializer"... Zadanie wymaga odemnie, abym użył typu const * char, ale nie mogę obejść tego błędu. Proszę o wskazówkę jak sobie z tym poradzić ;)
#include <iostream>
const int Seasons = 4;
const char * Snames = {"Wiosna", "Lato", "Jesien", "Zima"};
void fill(char * table, int liczba, double table2[]);
void show(char * table, int liczba, double table2[]);
int main()
{
double wydatki[4];
fill(Snames, Seasons, wydatki);
show(Snames, Seasons, wydatki);
return 0;
}
void fill(char * table, int liczba, double table2[])
{
using namespace std;
for (int i = 0; i < liczba; i++)
{
cout << "Podaj wydatki za okres >>" << table[i] << "<<: ";
cin >> table2[i];
table[i] = table2[i];
}
}
void show(char * table, int liczba, double table2[])
{
using namespace std;
double total = 0.0;
cout << "\nWYDATKI\n";
for (int i = 0; i < liczba; i++)
{
cout << table[i] << ": " << table2[i] << " zl" << endl;
total += table2[i];
}
cout << "Laczne wydatki roczne: " << total << " zl " << endl;
}