Дописать пару строчек в скрипте на языке c# unity using system.collections; using system.collections.generic; using unityengine; using unityengine.ui; public class newbehaviourscript : monobehaviour { public questionlist[] questions; public text[] answerstext; public text qtext; list qlist; questionlist crntq; int randq; public void omclickplay() { qlist = new list(questions); questiongenerate(); } void questiongenerate() { if (qlist.count > 0) { randq = random.range(0, qlist.count); crntq = qlist[randq] as questionlist; qtext.text = crntq.question; list answers = new list(crntq.answers); for (int i = 0; i < crntq.answers.length; i++) { int rand = random.range(0, answers.count); answerstext[i].text = answers[rand]; answers.removeat(rand); } } else { print("вы завершили раунд"); } } public void answersbttns(int index) { if (answerstext[index].text.tostring() == crntq.answers[0]) print("правильный ответ"); else print("неправильный ответ"); qlist.removeat(randq); questiongenerate(); } } [system.serializable] public class questionlist { public string question; public string[] answers = new string[3]; } как сделать так что бы при неправильно варианте ответа, следующий вопрос не начинался. а это всё в этих строчках public void answersbttns(int index) { if (answerstext[index].text.tostring() == crntq.answers[0]) print("правильный ответ"); else print("неправильный ответ"); qlist.removeat(randq); questiongenerate(); }
using namespace std;
long Factorial(int num)
{
long res = 1;
for (int i = num; i > 1; i--)
res *= i;
return res;
}
int NumOfElements(int **matrix, int mSize, int nSize)
{
int res = 0;
for (int i = 0; i < mSize; i++)
{
for (int j = 0; j < nSize; j++)
if (matrix[i][j] % 2 == 0 && matrix[i][j] < 0)
res++;
}
return res;
}
int main()
{
int
num,
**matrix,
mSize,
nSize;
cout << "Input a number: ";
cin >> num;
cout << num << "! = " << Factorial(num) << endl;
cout << "Input a matrix size: ";
cin >> mSize >> nSize;
matrix = new int*[mSize];
for (int i = 0; i < mSize; i++)
matrix[i] = new int[nSize];
for (int i = 0; i < mSize; i++)
for (int j = 0; j < nSize; j++)
cin >> matrix[i][j];
cout << "Num. of the elements = " << NumOfElements(matrix, mSize, nSize) << endl;
system("pause");
return 0;
} /* End of the 'main' function */