Как исправить вылет
это херня присутствует сначала разработки да да мини канкулятор вот вылет
хотел исправить я гуглил как исправить вылет но нечего выдала может разберемся вместе как это исправить.
Код для 0.2
#include <iostream>
int main()
{
float num1, num2,res{};
std::cout << «enter num1: »;
std::cin >> num1;
std::cout << «enter num2: »;
std::cin >> num2;
char math;
std::cout << «enter math symbol: »;
std::cin >> math;
if (math == '+')
res = num1 + num2;
else if (math == '-')
res = num1 — num2;
else if (math == '*')
res = num1 * num2;
else if (math == '/')
res = num1 / num2;
std::cout << «result: » << res;
float *val = new float;
char* symbols = new char[35];
delete[6] symbols;
int* nums = new int[15];
nums[0] = 45;
delete[2] nums;
int res = 1;
return 0;
}
#include <iostream>
int main()
{
float num1, num2, res{};
std::cout << «enter num1: »;
std::cin >> num1;
std::cout << «enter num2: »;
std::cin >> num2;
char math;
std::cout << «enter math symbol: »;
std::cin >> math;
if (math == '+')
res = num1 + num2;
else if (math == '-')
res = num1 — num2;
else if (math == '*')
res = num1 * num2;
else if (math == '/')
{
if (num2 != 0)
res = num1 / num2;
else
{
std::cout << «Error: division by zero!\n»;
return 1;
}
}
else
{
std::cout << «Error: unknown operator!\n»;
return 1;
}
std::cout << «result: » << res << "\n";
float* val = new float;
*val = 3.14f;
delete val;
char* symbols = new char[35];
delete[] symbols;
int* nums = new int[15];
nums[0] = 45;
delete[] nums;
return 0;
}
Работает