Mam problem z tworzeniem mojego pierwszego "symulatora"
kod
//kod
//Pliki nagłówkowe
#include <iostream>
#include <conio.h>
#include <ctime>
#include "RPG Fight simulator.h"
using namespace std;
void main()
{
//MENU
cout << " RPG FIGHT SIMULATOR " << endl;
cout << "-----------------------------------------------------------------------------------------------------------------------" << endl;
int nOpcjamenu;
cout << " " << endl;
cout << " WYBIERZ OPCJE" << endl;
cout << " 1. ZACZNIJ SYMULACJE MAGA" << endl;
cout << " 2. ZACZNIJ SYMULACJE LUCZNIKA" << endl;
cout << " 3. ZACZNIJ SYMULACJE WOJOWNIKA" << endl;
cout << " 4. ZACZNIJ SYMULACJE BARBARZYNCY" << endl;
cout << " 5. ZACZNIJ SYMULACJE LOWCY" << endl;
cout << " WYBOR: ";
cin >> nOpcjamenu;
switch (nOpcjamenu)
{
case 1:
//ATAK MAGA WYBOR
cout << "------------------------------------------------------------------------------------------------------------------------" << endl;
cout << " " << endl;
cout << "WYBIERZ ATAK" << endl;
cout << "1. ATAK ZWYKLY 30 - 70 " << endl;
cout << "2. ATAK SPECJALNY 20 - 85 " << endl;
cout << "3. ATAK MAGICZNY 35 - 100 " << endl;
cout << "WYBOR: ";
int nWybor1;
cin >> nWybor1;
switch (nWybor1)
case 1:
//ATAK MAGA WYBOR PODSUMOWANIE
cout << "---------------------------------------------------------------------------------------------------------------------" << endl;
srand((int)time(NULL));
int nObrazeniamag1 = rand() % 40 + 30;
srand((int)time(NULL));
int nObrazeniamagPotw1 = rand() % 50 + 50;
cout << "ZADANE OBRAZENIA " << nObrazeniamag1 << "." << endl;
cout << "OTRZYMANE OBRAZENIA " << nObrazeniamagPotw1 << "." << endl;
if (nObrazeniamag1 > nObrazeniamagPotw1)
{
cout << "BRAWO! WYGRALES" << endl;
}
else
{
cout << "NIESTETY PRZEGRALES" << endl;
}
case 2:
//ATAK SPEC MAG
cout << "--------------------------------------------------------------------------------------------------------------------------" << endl;
srand((int)time(NULL));
int nObrazeniamagpotw2 = rand() % 50 + 50;
srand((int)time(NULL));
int nObrazeniamag2 = rand() % 50 + 50;
}
}
Problem otóż jest w zmiennej
pokazuje:
Błąd C2360 Inicjalizacja "nObrazeniamagPotw1" jest pomijana przy etykiecie "case"