Я делаю программу, которая создает звук, и я пытаюсь ввести файл с разными частотами для создания песни. Однако, когда я пытаюсь скомпилировать, я получаю сообщение об ошибке, которое говорит о том, что возникла проблема с открытием входного файла, я делаю какие-либо очевидные ошибки, которые кто-либо может увидеть?
#include <iostream>
#include <math.h>
#include "wav.hpp"
#include <fstream>
#include <vector>
#include <cstdlib>
using namespace std;
int main(){
std::ifstream ifile("odetojoy.txt", std::ios::in);
std::vector<double> scores;
//check to see that the file was opened correctly:
if (!ifile.is_open()) {
std::cerr << "There was a problem opening the input file!\n";
exit(1);//exit or do additional error checking
}
double num = 0.0;
//keep storing values from the text file so long as data exists:
while (ifile >> num) {
scores.push_back(num);
}
//verify that the scores were stored correctly:
for (int i = 0; i < scores.size(); ++i) {
std::cout << scores[i] << std::endl;
Я знаю, что конечные фигурные скобки отсутствуют , это только код, связанный с открытием файла