Czesc jestem nowy i mam problem z zadaniem a wlasciwie to z przeslaniem go… W Visual studio wszystko dziala - tak mi sie wydaje. Jezeli ktos moze cos sie wypowiedziec w ktorym miejscu cos skopalem to bardzo prosze.
#include
#include
using namespace std;
void var(bool * v);
int main()
{
bool t = false;
int * arr;
cout << "Podaj n liczb: ";
int n;
cin >> n;
arr = new int[n];
string * str;
str = new string[n];
int i = 0;
while (i < n)
{
int temp;
cout << "Podaj " << i + 1 << " liczbe: ";
cin >> temp;
if (temp <= 1)
{
arr[i] = temp;
str[i] = "NIE\n";
i++;
continue;
}
for (int j = 2; j < temp; j++)
{
if (temp % j == 0)
{
t = true;
break;
}
}
if (!t)
{
str[i] = "TAK\n";
}
else if (t)
{
str[i] = "NIE\n";
}
arr[i] = temp;
var(&t);
i++;
}
for (int k = 0; k < n; k++)
cout << str[k];
delete[] arr;
delete[] str;
cin.get();
cin.get();
return 0;
}
void var(bool * v)
{
*v = false;
}