C++ 为什么这个程序会提示我';按任意键继续';?

C++ 为什么这个程序会提示我';按任意键继续';?,c++,C++,我试图将数据从网页复制到结构数组中,并在生成数据之前按“名称”排序。当我运行这个程序时,它说按任意键继续 #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; struct productJewelry { string name; double amount; int i

我试图将数据从网页复制到结构数组中,并在生成数据之前按“名称”排序。当我运行这个程序时,它说按任意键继续

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;

struct productJewelry
{
      string name;
      double amount;
      int itemCode;
      double size;
      string group;    
};

int main()
{
  // declare variables
  ifstream inFile;
      int count=0;
      int x=0;

      productJewelry product[50];

  inFile.open("jewelry.txt");  // file must be in same folder
if (inFile.fail())
 cout << "failed";
  cout << fixed << showpoint;  // fixed format, two decimal places
  cout << setprecision(2);

  while (inFile.peek() != EOF)
  {
//         cout << count << " : ";
         count++;
         inFile>> product[x].itemCode;
         inFile>> product[x].name;
         inFile>> product[x].size;
         inFile>> product[x].amount;
         inFile>> product[x].group;
//         cout << product[x].itemCode << ", " << product[x].name << ", "<< product[x].size << ", " << product[x].amount << endl;
         x++;
         if (inFile.peek() == '\n')
           inFile.ignore(1, '\n');
  }

  inFile.close();
string temp;
bool swap;
       do
         {
           swap = false;
           for (int x=0; x<count;x++)
           {
             if (product[x].name>product[x+1].name)
             {
               //these 3 lines are to swap elements in array
               temp=product[x].name;
               product[x].name=product[x+1].name;
               product[x+1].name=temp;
               swap=true;
             }
           }
         } while (swap);

      for (x=0; x< count; x++)
      {
         //cout<< product[x].itemCode<<" ";
         //cout<< product[x].name <<" ";
         //cout<< product[x].size <<" ";
         //cout<<  product[x].amount<<" ";
         //cout<<  product[x].group<<" "<<endl;

      }

  system("pause");  // to freeze Dev-c++ output screen
  return 0;
}   // end main
#包括
#包括
#包括
#包括
使用名称空间std;
结构产品珠宝
{
字符串名;
双倍金额;
int项目代码;
双倍大小;
字符串组;
};
int main()
{
//声明变量
河流充填;
整数计数=0;
int x=0;
产品珠宝产品[50];
infle.open(“jewelry.txt”);//文件必须位于同一文件夹中
if(infle.fail())
库特积[x]。尺寸;
填充>>产品[x]。数量;
infle>>产品[x]。集团;
//cout它说“按任意键继续”,因为
system(“pause”)
调用的
pause
程序就是这样做的


它不输出任何其他内容,因为您已经注释掉了所有的输出语句

此代码对网页不起任何作用。它从文件中读取“珠宝”数据并按名称对其进行排序。行
系统(“暂停”)但是,当编译和运行时,除了按下任何键之外,没有任何显示出来,继续显示你期望的结果。你的问题需要更多的信息更新。C++用于打印珠宝数据文件并按字母顺序排序。理论顺序。。。。。。。