小编Rek*_*aru的帖子

CLion C++无法读取/打开项目目录中的.txt文件

我在项目目录中有一个.txt文件,我用数据填充.

目录结构如下:

/Users/asd/ClionProjects/ProjectWithTemplates/
main.cpp
cmake
twoday.txt
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

#include <iostream>
#include <array>
#include <cmath>
#include <fstream>


using namespace std;

/* print array prototype */
template <size_t N>
void printArray(const array<double , N> & arr);

/* mean function prototype */
template <size_t N>
double meanArray(const array<double , N> & arr);

/* standard deviation prototype */
template <size_t N>
double sDeviation(const array<double , N> & arr);

int main() {

    string date1;
    string date2;

    array<double, 24> day1Temps;
    array<double, 24> day2Temps;
    array<double, 3> testarr = …
Run Code Online (Sandbox Code Playgroud)

c++ io fstream readfile clion

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

OCaml - 创建自定义类型的自定义类型

如果我有数据类型识别和人,我该如何使用它们?

type identification = Name of string
| SS of int * int;;

type person = Personal_info of identification;;
Run Code Online (Sandbox Code Playgroud)

如何制作具有标识的人物类型?我如何构造一个包含这些类型的变量..?

像这样:

person1 = Personal_info (Name = "Cody") (SS = (231,4534));;
val person1 : person = .....
Run Code Online (Sandbox Code Playgroud)

constructor ocaml types

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

自RWO以来,OCaml编译器是否彻底改变了?

来自Real World OCaml的示例第60页

List.map ~f:((+) 3) [4;5;6;];;
Error: The function applied to this argument has type 'a list -> 'b list
This argument cannot be applied with label ~f
Run Code Online (Sandbox Code Playgroud)

来自HTML托管版RWO的相同示例

List.map ~f:((+) 3) [4;5;6];;
- : int list = [7; 8; 9]
Error: The function applied to this argument has type 'a list -> 'b list
This argument cannot be applied with label ~f
Run Code Online (Sandbox Code Playgroud)

显然有些重大改变了吗?为什么这些例子不起作用?有更好的书可供学习吗?

这种语言很棒,我想尽我所能,但资源很少.

ocaml

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

标签 统计

ocaml ×2

c++ ×1

clion ×1

constructor ×1

fstream ×1

io ×1

readfile ×1

types ×1