小编Joh*_*web的帖子

为什么我无法将源文件连接到头文件?

我试着制作一个名为Paitent_info.h的标题,你可以在这里看到:

#ifdef GUARD_Paitent_info
#define GUARD_Paitent_info

#include <iostream>
#include <string>
#include <vector>

struct Paitent_info {
    std::string name;
    std::vector<double> tem;
};

bool compare(const Paitent_info&, const Paitent_info&);
std::istream& read(std::istream&, Paitent_info&);
std::istream& read_tem(std::istream&, std::vector<double>&);
#endif
Run Code Online (Sandbox Code Playgroud)

这是Paitent_info.cpp:

#include "Paitent_info.h"

using std::istream; using std::vector;

bool compare(const Paitent_info& x, const Paitent_info& y)
{
    return x.name < y.name;
}


istream& read(istream& ip, Paitent_info& p)
{ // do something
    return ip;
}

istream& read_tem(istream& in, vector<double>& tem)
{ // do something
    return in;
}
Run Code Online (Sandbox Code Playgroud)

我收到了来自此代码的许多错误消息:

  1. 尚未声明std :: istream和std :: …

c++

-1
推荐指数
1
解决办法
51
查看次数

用grep解析字符串

我需要一些帮助来解析Linux中的字符串.

我有一个字符串:

[INFO] Total time: 2 minutes 8 seconds
Run Code Online (Sandbox Code Playgroud)

并且只想获得

2 minutes 8 seconds
Run Code Online (Sandbox Code Playgroud)

linux grep parsing sed

-2
推荐指数
3
解决办法
2万
查看次数

这个程序究竟出了什么问题?

以下代码应该提示用户输入一个数字,检查数字是否等于30,并打印是否是.

代码包含错误,不会运行.

解释什么是错的.

假设用户实际输入一个整数.

user_input = input("Enter an integer: ")

user_input = int(user_input)

if user_input = 30:

    print("The user entered 30.")

else:

    print("The user did not enter 30.")
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我无法确切地指出什么是错误的.

我觉得有什么不对的if,else声明的部分.我现在只使用Python 2周,我仍在努力理解它.

python

-2
推荐指数
1
解决办法
93
查看次数

如何从字符串中删除单引号并将其用于Python中的除法?

如何'从字符串中删除'/'并将其用于Python中的除法?

例如:

a='/'
b=6
c=3

bac
Run Code Online (Sandbox Code Playgroud)

答案应该是2.

python

-6
推荐指数
1
解决办法
131
查看次数

内置函数来比较C++中的字符串?

我需要一些内置函数来比较strings.我有C风格的字符串

strcmp();
Run Code Online (Sandbox Code Playgroud)

但我需要一些功能来处理这个string类.

string name1;
string name2;
Run Code Online (Sandbox Code Playgroud)

c++ function built-in

-6
推荐指数
1
解决办法
2060
查看次数

标签 统计

c++ ×2

python ×2

built-in ×1

function ×1

grep ×1

linux ×1

parsing ×1

sed ×1