ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

I used two different compilers at home, but here, I get compilation error!
Послано Marko 30 апр 2005 06:21
Here is the code in Dev-C++:

#include <iostream.h>
#include <stdlib.h>
#include <string>
#ifdef ONLINE_JUDGE
running on timus
#endif
using std::cout;
using std::cin;
using std::string;
int faktorijel(int x, int y)
{

           if (x == 0 || x < 0)
              return  1;
           else
           {
               return x * faktorijel(x-y, y);
           }
}
int main()
{
      int a;
      int s = 0;
      string b;
      cout << "Write an integer:"," ";
      cin >> a;
      cout << "Write factorial marks:";
      cin >> b;
      for (int i = 0; i < 50; i++)
      {
          if (b[i] == '!')
             s++;
      }

      cout << faktorijel(a, s)<< endl;
      cout << endl;
      system("PAUSE");
      return 0;
}
And here isthe code in Borland C++:


#include <iostream.h>
#include <stdlib.h>
#include <string>
#ifdef ONLINE_JUDGE
running on timus
#endif
/* using std::cout;
using std::cin; */
using std::string;
int faktorijel(int x, int y)
{

           if (x == 0 || x < 0)
              return  1;
           else
               return x * faktorijel(x-y, y);
}
void main()
{
      int a;
      int s = 0;
      string b;
      cout << "Write an integer:"," ";
      cin >> a;
      cout << "Write factorial marks:";
      cin >> b;
      for (int i = 0; i < 50; i++)
      {
          if (b[i] == '!')
             s++;
      }

      cout << faktorijel(a, s)<< endl;
      system("PAUSE");
}

Most interesting is that my problem 1000 (for debils) doesn't work!:

/* Dev-C++ */
#include <iostream.h>

int main()
{

    long i;
    long j;
    long s;
    s = 0;
    cout <<"Input i";
    cin >> i;
    cout << "Input j";
    cin >> j;
    s = i + j;
    cout << s;
    return 0;
}
Re: I used two different compilers at home, but here, I get compilation error!
Послано Problemset Maintainer 30 апр 2005 12:58
Marko писал(a) 30 апреля 2005 06:21
int main()
{

    long i;
    long j;
    long s;
    s = 0;
    cout <<"Input i";
    cin >> i;
    cout << "Input j";
    cin >> j;
    s = i + j;
    cout << s;
    return 0;
}

Delete these lines:

cout <<"Input i";
cout << "Input j";
Re: I used two different compilers at home, but here, I get compilation error!
Послано Marko Bogdan 1 май 2005 01:56
Yes, Timus doesn't understand this:
string b;
cin >> a;
cin >> b;
for (int i = 0; i < 50; i++)
{
if (b[i] == '!')
s++;
}

he want's little bit of this:

      char b[50];
      scanf("%s",b);
      s = strlen(b);
Re: I used two different compilers at home, but here, I get compilation error!
Послано Problemset Maintainer 1 май 2005 02:33
Marko Bogdan писал(a) 1 мая 2005 01:56
Yes, Timus doesn't understand this:
string b;
cin >> a;
cin >> b;
for (int i = 0; i < 50; i++)
{
if (b[i] == '!')
s++;
}
This should work. Plaese, post the whole source.