请帮忙找出错误
Please help in finding the error
我在 NetBeans 上做了一个程序,但是我有一个错误,我不知道该怎么做。
如果你们中有人能帮助我,那就太好了。
以下是我需要回答的问题:
尽可能干净地编写一个 C++ 程序:
1) 声明一个数组classique1
t1 个字符串 ("to C") 包含
星期几的名称(星期一、星期二...)
2) 从 t1、t2 建立一个新的经典 table 也包含名字
星期几,但按字母升序排序
3) 以每行一个的比例显示天名,tables t1和t2的内容
4) 删除 table t2
5) 结束
在这个 LINK 中:http://www.codeshare.io/wGWlQ 是我做的程序。
"as cleanly as possible a C++ program"怎么样:
std::array<std::string, 7> t1 = { // Array of strings t1
"Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"
};
auto t2 = t1; // Create t2
std::sort(std::begin(t2), std::end(t2)); // to sort the right order
std::cout << "t1 content: " << std::endl; // Display contents
for (const auto& x : t1) {
std::cout << x << std::endl;
}
std::cout << "t2 content: " << std::endl; // Display contents
for (const auto& x : t2) {
std::cout << x << std::endl;
}
// Remove the table t2
// Ends
如果你真的必须使用 C 字符串,你可以将数组的类型更改为 const char*
?
我在 NetBeans 上做了一个程序,但是我有一个错误,我不知道该怎么做。 如果你们中有人能帮助我,那就太好了。
以下是我需要回答的问题:
尽可能干净地编写一个 C++ 程序:
1) 声明一个数组classique1 t1 个字符串 ("to C") 包含 星期几的名称(星期一、星期二...)
2) 从 t1、t2 建立一个新的经典 table 也包含名字 星期几,但按字母升序排序
3) 以每行一个的比例显示天名,tables t1和t2的内容
4) 删除 table t2
5) 结束
在这个 LINK 中:http://www.codeshare.io/wGWlQ 是我做的程序。
"as cleanly as possible a C++ program"怎么样:
std::array<std::string, 7> t1 = { // Array of strings t1
"Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"
};
auto t2 = t1; // Create t2
std::sort(std::begin(t2), std::end(t2)); // to sort the right order
std::cout << "t1 content: " << std::endl; // Display contents
for (const auto& x : t1) {
std::cout << x << std::endl;
}
std::cout << "t2 content: " << std::endl; // Display contents
for (const auto& x : t2) {
std::cout << x << std::endl;
}
// Remove the table t2
// Ends
如果你真的必须使用 C 字符串,你可以将数组的类型更改为 const char*
?