How can I resolve debug error?

주열 박 0 Reputation points
2023-01-26T06:56:33.25+00:00

I used visual studio to code c++.

How can I fix this error?

sdsda

My code


#include <iostream>
#include <fstream>
#include <string>

int main()
{
    using namespace std;
    string filename = "C:/Users/park7/Desktop/console/data.csv";
    ifstream csv(filename);
    string s;
    if (!csv.is_open()) {
        cout << "파일 열기 실패: " + filename << endl;
        return 1;
    }
    auto old_prec = cout.precision();
    cout.precision(3);
    while (getline(csv, s)) {
        int a, b;
        string col1 = "", col2 = "";
        if (s == "") continue;
        if (s.find(',') == -1) continue;
        col1 = s.substr(0, s.find(','));
        col2 = s.substr(s.find(',') + 1);
        a = stoi(col1);
        b = stoi(col2);
        cout
            << a << "+" << b << "=" << a + b << endl
            << a << "-" << b << "=" << a - b << endl
            << a << "*" << b << "=" << a * b << endl;
        cout
            << a << "/" << b << "=";
        if (b == 0)
            cout << "0으로 나눌 수 없음" << endl;
        else
            cout << (float)a / b << endl;
        cout << endl;
    }
    cout.precision(old_prec);
    csv.close();

    
    return 0;
}

data.csv


sssssss

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,595 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,525 questions
{count} votes