program nie chce sie kompilowac-funkcja

0

Program pokazuje:
error: expected unqualified-id before '{' token
o co chodzi?

include <iostream>

using namespace std;
void temperatura (double stopnie, int skala);
int main()
{
    cout<"jaka jest temperatura?:";
    int m;
    cin>>m;
    temperatura(m,0);
}
//***************************************************************************
void temperatura (double stopnie, int skala);
{
    cout < "temperatura to";
   switch (skala)
   {
       case 0:
           cout<<stopnie<<;
           break;
       case 1:
           cout<<stopnie+100;
           break;
       case 2:
           cout<<stopnie+200;
           break;
   }
}
0

niepotrzebny średnik
jeden operator << za dużo

0

gdzie?

0
void temperatura (double stopnie, int skala);

tutaj bez średnika

0

Literówka. Przy definicji funkcji

void temperatura (double stopnie, int skala) //tu bez srednika 
{
    cout < "temperatura to";
   switch (skala)
   {
       case 0:
           cout<<stopnie<<;
           break;
       case 1:
           cout<<stopnie+100;
           break;
       case 2:
           cout<<stopnie+200;
           break;
   }
}
0

no tak ale teraz jest
expected initializer before 'int'
co jest zle?

0

Wrzuć aktualny kod.

0

<code
include <iostream>

using namespace std;
void temperatura (double stopnie, int skala);
int main()
{
cout<"jaka jest temperatura?:";
int m;
cin>>m;
temperatura(m,0);
}
//***************************************************************************
void temperatura (double stopnie, int skala)
{
cout < "temperatura to";
switch (skala)
{
case 0:
cout<<stopnie<<;
break;
case 1:
cout<<stopnie+100;
break;
case 2:
cout<<stopnie+200;
break;
}
}

0
Krwawy Mleczarz napisał(a):
void temperatura (double stopnie, int skala);

tutaj bez średnika

Na samej górze masz deklaracje(prototyp) funkcji

void temperatura (double stopnie, int skala);

Deklaracje tego typu kończysz średnikiem

Niżej masz definicje funkcji

void temperatura (double stopnie, int skala) {
   //instrukcje
}

Definicja funkcji nie kończy się średnikiem.

0
#include <iostream>

using namespace std;
void temperatura (double stopnie, int skala);
int main()
{
    cout<"jaka jest temperatura?:";
    int m;
    cin>>m;
    temperatura(m,0);
}
//***************************************************************************
void temperatura (double stopnie, int skala)
{
    cout < "temperatura to";
   switch (skala)
   {
       case 0:
           cout<<stopnie<<;
           break;
       case 1:
           cout<<stopnie+100;
           break;
       case 2:
           cout<<stopnie+200;
           break;
   }
}
0

Poczytaj lepiej kursy dotyczące podstaw.

#include <iostream>
 
using namespace std;
void temperatura (double stopnie, int skala);

int main()
{
    cout<<"jaka jest temperatura?:";
    int m;
    cin>>m;
    temperatura(m,0);
}
//***************************************************************************
void temperatura (double stopnie, int skala)
{
    cout << "temperatura to ";
   switch (skala)
   {
       case 0:
           cout<<stopnie;
           break;
       case 1:
           cout<<stopnie+100;
           break;
       case 2:
           cout<<stopnie+200;
           break;
   }
}
0

no tak literowka. Dzieki wszystkim za pomoc

1 użytkowników online, w tym zalogowanych: 0, gości: 1