Visual-C++ [向量]找不到存储在向量中的日期
因此,我将日期存储为字符串,然后循环遍历它,但找不到矢量的匹配日期。为了确保它通过向量循环,我将其他位置放在那里的底部,并且每次循环通过向量循环并且找不到日期将显示它。
[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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论