###前提・実現したいこと
c++で簡単なプログラムを書いている時にコンパイルエラーが出てしまいます。
やりたいことは、標準入力から受け取った数字をstd::arrayの宣言にサイズとして使用したいです。
###発生している問題・エラーメッセージ
practice4.cpp:9:17: error: non-type template argument of type 'int' is not an integral constant expression array< int, N > key, next; ^ practice4.cpp:9:17: note: read of non-const variable 'N' is not allowed in a constant expression practice4.cpp:7:12: note: declared here int i, N, M; ^ 1 error generated.
###該当のソースコード
C++
1#include <iostream> 2#include <array> 3 4using namespace std; 5 6int main() { 7 int i, N, M; 8 cin >> N >> M; 9 array< int, N > key, next; 10 return 0; 11}
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/08 05:50