小编bru*_*tto的帖子

适用于Python程序员的C/C++

我必须从Python切换到C/C++.
你知道一个快速的"参考教程"或类似的东西,以引用如何开始?例如Numpy和Scipy教程.
例如,我已经阅读了很多"文档"

  • C++ for dummies
  • K&R C编程语言
  • 许多博客和在线文档,例如:http://eli.thegreenplace.net/2010/01/11/pointers-to-arrays-in-c/,
  • http://newdata.box.sk/bx/c/
  • StackOverflow上的大量问答
  • ...

但是我仍然不清楚如何开始移植到C/C++之类的东西:

#!/usr/bin/env python

import time
import numpy as np
import tables as tb

"""Retrieve 3D positions form 1000 files and store them in one single HDF5 file.
"""

t = time.time()

# Empty array
sample = np.array([])
sample.shape = (0,3)

# Loop over the files
for i in range(0, 1000):
  filename = "mill2sort-"+str(i)+"-extracted.h5"
  print "Doing ", filename
  # Open data file
  h5f = tb.openFile(filename, 'r')
  # Stack new …
Run Code Online (Sandbox Code Playgroud)

c c++ python numerical

8
推荐指数
3
解决办法
8118
查看次数

C++ struct array初始化

还行吧:

int vec_1[3] = {1,2,3};
Run Code Online (Sandbox Code Playgroud)

那有什么不对

struct arrays{
  int x[3];
  int y[3];
  int z[3];
};
arrays vec_2;
vec_2.x = {1,2,3};
Run Code Online (Sandbox Code Playgroud)

这给出了
错误:无法在赋值时将'<brace-enclosed initializer list>'转换为'int'

我已经阅读了很多关于此错误的帖子,但目前还不清楚问题出在哪里.

c++ arrays struct initialization braces

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

标签 统计

c++ ×2

arrays ×1

braces ×1

c ×1

initialization ×1

numerical ×1

python ×1

struct ×1