Y
Y
Yaroslav Ryazanov2016-09-19 15:15:04
C++ / C#
Yaroslav Ryazanov, 2016-09-19 15:15:04

How to solve the problem of output from a stream?

There is a code:

#include <iostream>;
#include <conio.h>;
#include <string>;

using namespace std;


void area_ellipse()
{
  setlocale(LC_ALL, "Russian");
  cout << "\t\t\t\t\t****Площадь эллипса, через полуоси****\n\n\n\n" << "S = pi * R * r" << " Где R - большая полуось; r - малая полуось\n" << "Хотите воспользоваться калькулятором? y\n  ";
  string input;
  if (input == "y")
  {
    double pi(3.14), R(0), r(0);
    cout << "R = ";
    cin >> R;
    cout << "r = ";
    cin >> r;
    cout << R * r * pi << " = 3.14 * " << R << " " << r << endl;
  }
  else
  {
    exit(0);
  }
}


void area_of_plane_figures()
{
  setlocale(LC_ALL, "Russian");
  cout << "Доступно:\n 1) Площадь эллипса, через полуоси;\n 2) ;\n 3) ;\n 4) ;\n 5) ;\n 6) ;\n 7) ;\n 8) ;\n 9) Выход в главное меню;" << endl;
  int input;
  cin >> input;
  while (true)
  {
    if (input == 1)
    {

    }
  }
}


void main_formulas()
{
  setlocale(LC_ALL, "Russian");
  cout << "\t\t\t\t\t****Формулы****\n\n\n\n" << endl;
  cout << "Доступно:\n 1) Площадь плоских фигур;\n 2) ;\n 3) ;\n 4) ;\n 5) ;\n 6) ;\n 7) ;\n 8) ;\n 9) Выход в главное меню;" << endl;
  while (true)
  {
    int input;
    cin >> input;
    switch (input)
    {
    case 1: cout << "\t\t\t\t\t****Площадь плоских фигур****\n\n"; area_of_plane_figures(); break; break;
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:
    }
  }

}


void main_start()
{
  setlocale(LC_ALL, "Russian");
  cout << "Доступно:\n 1) Формулы; 9) Выход;" << endl;

  while (true)
  {
    int input;
    cin >> input;

    switch (input)
    {
    case 1: main_formulas(); break;
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
    case 9: exit(0); break;
    default: cout << "Неизвестный ввод! Повторите попытку.";
    }
  }

  _getch();

}


int main()
{
  setlocale(LC_ALL, "Russian");
  cout << "\t\t\t\t\t****Проект****\n\n\n\n" << endl;
  main_start();
  return 0;
}

There is an error in lines 17, 18 and 19. Here is what codepad.org writes:
Line 19: error: extra tokens at end of #include directive
Line 18: error: extra tokens at end of #include directive
Line 19: error: conio.h: No such file or directory
Line 17: error: extra tokens at end of #include
directive

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-09-19
@BRUC

#include <iostream>;
This is not C syntax, but a preprocessor directive. Remove the semicolon.
conio.h is not a standard header, but a Windows-specific one. _getch()Of course, you will have to use something else instead .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question