没有从cout获得输出
Not getting output from 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;
}
我唯一的输出是"输入文件已打开"。
。。。。。。
if (inFile.fail()) {
cout << "can't open the input file" << endl;
}
else {
cout << "input file is open" << endl;
}
//return 0;
注释此return 0;
,这将使程序退出。
相关文章:
- 为什么在C的循环中使用printf的Rust代码不显示输出,而在C++的循环中显示std::cout
- std::cout输出int时出现编译错误
- COUT 无法提供输出可能是由于内联组装
- 为什么我的 cout 在输出中没有显示字符串?
- 调用 cout 时如何在结构中输出常量文本?
- 如何在C++中编写 ostream 的向量,它接收所有不同的输出流,如 cout、ostringstream 和 ofs
- Vscode/C++ - cout 无法输出完整的句子,也无法与整数连接
- 我的 cout 上有一个奇怪的输出,它把答案放在第一位,然后在我调用它的地方放一个奇怪的输出.我该怎么办?
- 在 CPP 中使用 cout 的重复输出
- 在 c++ 中使用 cout.precision() 的奇怪输出
- 为什么'std::cout << !+2 '输出 0?
- 对于输出,std::copy是否比std::cout快
- 在视觉工作室中以十六进制进行位移位并通过 cout 输出
- 输出使用 cout 转换为 ASCII 的文本时输出格式不正确,C++
- 如何从控制台 c++(从 cout)捕获输出
- 为什么cout输出内存地址不是字符串?
- Jupyter笔记本未显示C 输出(COUT)
- 输出 cout 是感叹号.C++
- 无法从C++循环实现所需的输出 (COUT)
- "定向到标准输出(cout)"是什么意思?