다음은 Perl의 데이터 생성기 스크립트입니다. 겸손 자세한 C 펄 생성 된 데이터는 유닉스 sort
프로그램이 수행하는 것과 같은 방식으로 파일을 정렬 ++ 프로그램을
#!/usr/bin/env perl
use strict;
use warnings;
foreach my $i (1..239)
{
my $h1 = 10 + rand 8;
my $h2 = $h1 + 1;
my $m1 = rand 60;
my $m2 = rand 60;
printf "%.2d:%.2d,%.2d:%.2d\n", $h1, $m1, $h2, $m2;
}
을 그리고 여기 : 각 줄에 2 회를 생성하고, 두 번째는 항상 나중에 첫번째보다.
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<std::string> input;
std::string line;
while (std::getline(std::cin, line))
input.push_back(line);
std::sort(input.begin(), input.end());
//C++03
//for (std::vector<std::string>::iterator it = input.begin(); it != input.end(); ++it)
// std::cout << *it << std::endl;
//C++11
for (auto &it : input)
std::cout << it << std::endl;
}
거기 C++를 압축하는 방법 일 수 있지만 (맥 OS X 10.8.3에 G ++ 4.7.1) 나를 위해 작동 될 수 있습니다
g++ -O3 -g -std=c++11 -Wall -Wextra rs.cpp -o rs
는 펄을 압축 할 수있는 방법이 분명히 있습니다 암호.
'초승달 모양'이란 무엇입니까? – Rollie
단계별로 단계별 접근 - 먼저 CSV 라인을 https://www.google.com.au/#output=search&sclient=psy-ab&q=read+csv+line+by+line+c%2B%2B&oq별로 읽으십시오. = read + csv + line + by + line + c % 2B % 2B & gs_l = hp.3..0i22i30.284.5223.0.5471.25.15.0.10.10.0.245.2936.0j12j3.15.0 ... 0.0 ... 1c.1.14. psy-ab.Tj-9OGnIXVc & pbx = 1 & bav = on.2 또는 .r_cp.r_qf. & bvm = bv.47008514, d.aGc & fp = 5741f610caf3269 & biw = 952 & bih = 999 그리고 벡터에 저장하십시오. 정렬은 튜토리얼을 찾을 때마다 잘 처리되므로 문제가되지 않아야합니다. – sashkello
나는 정말로 미안하다, 나는 오름차순을 의미했다. txt 파일입니까, 변경 되었습니까? – shinoda898