[英]c++ check if array equals array not made
Ddoes any body know how do do this? Ddoes 任何机构知道如何做到这一点? Thanks if you do.
谢谢,如果你这样做。 I am new in c++. I don't know what do do.
我是c++的新人。我不知道该做什么。 Python is much better in my opinion.
Python 在我看来要好得多。
#include <bits/stdc++.h>
using namespace std;
int main(){
int nums[] = {1, 2, 3, 4};
if (nums == [1, 2, 3, 4]){
cout<<1;
}
}
You should use std::array
instead of plain arrays to realize this.您应该使用
std::array
而不是普通的 arrays 来实现这一点。
#include <iostream>
#include <array>
int main(void) {
std::array<int, 4> nums = {1, 2, 3, 4};
if (nums == std::array<int, 4>{1, 2, 3, 4}){
std::cout<<1;
}
}
Also see:另见:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.