Can you help me ?

And I need to correct one mistake...

#include <iostream>
#include <string>


using namespace std;

struct Klinikos
{
string Patalpos;
float Temperatura;
float Dregme;
bool moreTemp;
};
void KarscioIndeksas(float Temperatura, float Dregme);//funkcija atlikti KI formule
void inputOras(float Temperatura, float Dregme); //funkcija duomenis gauti is vartotojo
bool moreTemp(); //Vartotojas gali paklausti, ar nori keisti temperatura
void TemperaturosTipas(); // F or C

class Ligonine // hospital
{
private:
int PK;
Klinikos *Patalpos;

public:
Ligonine ()
{
PK = 6; //Patalpu Kiekis
Patalpos = new Klinikos[PK];

Klinikos[0].Patalpos = "Palata"; < --- *the mistake starts from here !
Klinikos[1].Patalpos = "Operacine";
Klinikos[2].Patalpos = "Vaistu saugykla";
Klinikos[3].Patalpos = "Gydytojo kabinetas";
Klinikos[4].Patalpos = "Koridorius";
Klinikos[5].Patalpos = "Reanimacija";

for (int i=0; i<6; i++)
{
Klinikos[i].Patalpos=6;
}
}

}; // klase ligonine


P.S. The "issues" window shows: expected unqualified-id before '[' token

so what should I do now.. can you help me ? :|
Last edited on
Using code tags would really be of some help.

1
2
3
Patalpos = new Klinikos[PK];

Klinikos[0].Patalpos = "Palata"; <


In the second line above you need to use the instance of the type not the type.

Patalpos[0].Patalpos = "Palata";

Using the same names for these variables is going to get confusing very quickly. I suggest you rename one of the variables to something else.

Last edited on
Thank you so much. :)
1
2
3
4
for (int i=0; i<6; i++)
{
   Klinikos[i].Patalpos=6;
}
not sure what is your intention there
Last edited on
Topic archived. No new replies allowed.