Visual-C++ [向量]找不到存储在向量中的日期

发布于 2025-01-21 17:56:52 字数 1117 浏览 0 评论 0原文

因此,我将日期存储为字符串,然后循环遍历它,但找不到矢量的匹配日期。为了确保它通过向量循环,我将其他位置放在那里的底部,并且每次循环通过向量循环并且找不到日期将显示它。

[1] https://i.sstatic.net/ka17b.png

cout << "Please enter a date: ";

                 cin >> searchByDate;
                 for (columnCount = 0; columnCount < currentRow; columnCount++)
                 {
                     if (searchByDate == DATE[columnCount])  
                     {
                         cout << DATE[columnCount] << "\t" << CUSTNAME[columnCount] << "\t" << GENDER[columnCount] << "\t" << IDENTITY[columnCount] << "\t";
                         cout << TELEPHONE[columnCount] << "\t" << TYPE[columnCount] << "\t" << THERAPIST[columnCount] << "\t" << CHARGES[columnCount] << endl;
                         totalRevenue += CHARGES[columnCount];
                     }
                     else
                         cout << "date 404";

帮助!紧急情况!

So, I had my dates stored as a string, and loop through it but it cannot find the matching date from the vector. To make sure it loops through the vector, I put else at the bottom there and for every time it loops through the vector and is not found the date will display it.

[1] https://i.sstatic.net/KA17B.png

cout << "Please enter a date: ";

                 cin >> searchByDate;
                 for (columnCount = 0; columnCount < currentRow; columnCount++)
                 {
                     if (searchByDate == DATE[columnCount])  
                     {
                         cout << DATE[columnCount] << "\t" << CUSTNAME[columnCount] << "\t" << GENDER[columnCount] << "\t" << IDENTITY[columnCount] << "\t";
                         cout << TELEPHONE[columnCount] << "\t" << TYPE[columnCount] << "\t" << THERAPIST[columnCount] << "\t" << CHARGES[columnCount] << endl;
                         totalRevenue += CHARGES[columnCount];
                     }
                     else
                         cout << "date 404";

Help! Emergency!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文