请帮助查找错误

Please help in finding the error

本文关键字:错误 查找 帮助      更新时间:2023-10-16

我在NetBeans上做了一个程序,但有一个错误,我不知道该怎么做。如果你们中有人能帮助我,那就太好了。

以下是我需要回答的问题:

尽可能干净地编写一个C++程序:

1) 声明数组classique1t1字符串("到C"),包含一周中的日期名称(星期一、星期二、…)

2) 从t1到t2建立一个新的经典表,其中还包含名称一周中的几天,但按字母顺序升序排列

3) 以每行一天名称的速率显示表t1和t2 的内容

4) 删除表t2

5) 结束

在这个链接中:http://www.codeshare.io/wGWlQ就是我做的节目。

"尽可能干净的C++程序":

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*