0
У меня есть этот проект, который связан со связанными списками. На данный момент я просто хочу вывести то, что у меня есть, чтобы я мог видеть, что я работаю, и посмотреть, где я нахожусь, и я даже не могу этого сделать.Не получать вывод из cout
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
struct node;
typedef node* nodePtr;
struct node {
int x;
int hour;
int minute;
string owner_name;
string pet_name;
node* next;
};
void CreateList(nodePtr first, ifstream& inFile);
void PrintList(nodePtr first);
int main()
{
nodePtr first;
ifstream inFile("vetAppts.txt");
if (inFile.fail()) {
cout << "can't open the input file" << endl;
}
else {
cout << "input file is open" << endl;
}
return 0;
cout << "dsadsa";
CreateList(first, inFile);
PrintList(first);
}
void CreateList(nodePtr first, ifstream& inFile) {
nodePtr newApp;
newApp = new node;
first = NULL;
while (!inFile.eof()) {
inFile >> first->hour;
inFile.get();
inFile >> first->minute;
getline(inFile, first->owner_name);
getline(inFile, first->pet_name);
}
cout << first->hour << first->minute << first->owner_name << first->pet_name;
}
Единственный выход, который у меня есть, - «Входной файл открыт».
Ваша программа заканчивается сразу после строки «входной файл открыта» ('return 0'). – vesan
Это не проблема, но не используйте 'std :: endl', если вам не нужен дополнительный материал, который он делает. '' \ n'' заканчивает линию. –