Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Название темы: Простые числа на Си++
Показать сообщение отдельно

Новый участник


Сообщения: 42
Благодарности: 0

Профиль | Отправить PM | Цитировать


CouttyXCodeR спасибо вам.Дело пошло.Мне просто непривычен синтаксис си++ - только начал изучать.Вот что вышло:
#include <math.h>
#include <conio.h>
#include <iostream.h>
int main(int argc, char *argv[])
{
using namespace std;
double n,i,j;
bool est;
clrscr;
cout << "\nVvedite konechnoe chislo n= ";
cin >> n;
i=1;
while (i<=n-2) do {
i=i+2;
est=false;
for (j=3; j<round(sqrt(i)); j++) //тут я не уверен - что то наворочено
if i mod j = 0 then begin
est:=true;
break;
}
}
if (!est)
cout << "Result: i=" << i;
getch();
return 0;
}
Вот список ошибок:
[C++ Error] Unit1.cpp(16): E2268 Call to undefined function 'round'
[C++ Error] Unit1.cpp(17): E2376 If statement missing (
[C++ Error] Unit1.cpp(21): E2308 do statement must have while
[C++ Warning] Unit1.cpp(21): W8004 'est' is assigned a value that is never used
[C++ Error] Unit1.cpp(22): E2040 Declaration terminated incorrectly
[C++ Error] Unit1.cpp(25): E2040 Declaration terminated incorrectly
[C++ Error] Unit1.cpp(26): E2190 Unexpected }

Отправлено: 20:25, 11-03-2007 | #6

Название темы: Простые числа на Си++