/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <conio.h>
#include <iostream>
using namespace std;
main ()
{
int i, n;
do
{
bool isPrime = true;
cout << "\nWpisz liczbe (0 - koniec): ";
cin >> n;
if (n == 0 || n == 1)
{
isPrime = false;
}
else
{
for (i = 2; i <= n / 2; ++i)
{
if (n % i == 0)
{
isPrime = false;
break;
}
}
}
if (isPrime)
cout << n << " to jest liczba pierwsza. ";
else
cout << n << " to nie jest liczba pierwsza. ";
}
while (n != 0);
return 0;
}
while(true) {
char c;
string surname;
cout << "Enter surname (RETURN to quit): ";
cin.get(c)
if(c == '\n') break;
cin >> surname;
if(c != ' ' and c != '\t' and c != '\n')
surname.insert(0, c);
}
return 0;