Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 当我运行这个程序时,它会说;按任意键继续“;?_Silverlight - Fatal编程技术网

Silverlight 当我运行这个程序时,它会说;按任意键继续“;?

Silverlight 当我运行这个程序时,它会说;按任意键继续“;?,silverlight,Silverlight,按任意键继续是因为系统(“暂停”)当系统(“暂停”)被取出时,程序不会显示屏幕。。。由于某些原因,程序不会读取和打印文件Jewelry.txt #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; struct productJewelry { string name; double

按任意键继续是因为
系统(“暂停”)

当系统(“暂停”)被取出时,程序不会显示屏幕。。。由于某些原因,程序不会读取和打印文件Jewelry.txt
#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
0011 Money_Clip        2.000  50.00 Other
0035 Paperweight       1.625 175.00 Other
0457 Cuff_Bracelet     2.375 150.00 Bracelet
0465 Links_Bracelet    7.125 425.00 Bracelet
0585 Key_Chain         1.325  50.00 Other
0595 Cuff_Links        0.625 525.00 Other
0935 Royale_Pendant    0.625 975.00 Pendant
1092 Bordeaux_Cross    1.625 425.00 Cross
1105 Victory_Medallion 0.875  30.00 Pendant
1111 Marquis_Cross     1.375  70.00 Cross
1160 Christina_Ring    0.500 175.00 Ring
1511 French_Clips      0.687 375.00 Other
1717 Pebble_Pendant    1.250  45.00 Pendant
1725 Folded_Pendant    1.250  45.00 Pendant
1730 Curio_Pendant     1.063 275.00 Pendant