[問題] c++排序問題
( *[1m *[m 為色碼,可以按 Ctrl+V 預覽會顯示的顏色 )
( 未必需要依照此格式,文章條理清楚即可 )
遇到的問題: (題意請描述清楚)
做frame分區 以80個數值為1個frame
應該是由1到40
程式執行結果由-1到38
希望得到的正確結果:
由1到40的排列
程式跑出來的錯誤結果:
程式結果
http://www.wretch.cc/album/show.php?i=cd121017&b=1&f=1024753561&p=0
開發平台: (例: VC++ or gcc/g++ or Dev-C++, Windows or Linux)
VC2008
有問題的code: (請善用置底文標色功能)
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main(int argc,char* argv[])
{
ifstream inFile("a1.txt");
string line;
int count = 0;
int size,frame;
while(getline(inFile,line)){
count++;
size=count;
frame=(size-240)/(240-160)+1;
cout<<count<<" : "<<line<<endl;
cout<<"frame: "<<frame<<endl;
if(count%80==0) system("pause");
}
inFile.close();
}
補充說明:
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.101.58.9
→
11/10 14:40, , 1F
11/10 14:40, 1F
→
11/10 14:40, , 2F
11/10 14:40, 2F
→
11/10 14:40, , 3F
11/10 14:40, 3F
→
11/10 14:48, , 4F
11/10 14:48, 4F
→
11/10 14:50, , 5F
11/10 14:50, 5F
→
11/10 15:22, , 6F
11/10 15:22, 6F
→
11/10 15:25, , 7F
11/10 15:25, 7F
→
11/10 15:57, , 8F
11/10 15:57, 8F
→
11/10 16:05, , 9F
11/10 16:05, 9F
→
11/10 16:55, , 10F
11/10 16:55, 10F
→
11/10 20:54, , 11F
11/10 20:54, 11F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章