Linear Shifted Array Generator by !kKo
output_file<<((end-start)/shift)+1<<endl; // number of entries...
int j=0;
for (int i=start; i<=end; i=i+shift) // making array
{
array[j++]=i;
}
// Uncomment the following line to display the whole array.
// for (i=0;i<(end-start)/shift;i++){cout<<array[i]<<" ";} cout<<endl;
for (i=shift;i<=(end-start)/shift;i++) // writing to file
{
output_file<<array[i]<<" ";
}
for (i=0;i<shift;i++) // writing to file
{
output_file<<array[i];
if(i<shift-1) output_file<<" ";
}
output_file<<endl;
int j=0;
for (int i=start; i<=end; i=i+shift) // making array
{
array[j++]=i;
}
// Uncomment the following line to display the whole array.
// for (i=0;i<(end-start)/shift;i++){cout<<array[i]<<" ";} cout<<endl;
for (i=shift;i<=(end-start)/shift;i++) // writing to file
{
output_file<<array[i]<<" ";
}
for (i=0;i<shift;i++) // writing to file
{
output_file<<array[i];
if(i<shift-1) output_file<<" ";
}
output_file<<endl;
Download Full Source Code
'geek_stuff > today' 카테고리의 다른 글
맥북을 지를까.. (3) | 2006.06.21 |
---|---|
HSBC의 OTP (One time password) device. (3) | 2006.06.01 |
Tistory 초대권 응모관련... (17) | 2006.05.27 |
Tistory.com Beta에서의 첫 글 (3) | 2006.05.26 |
1kko.com 블로그의 변천사 (0) | 2006.05.21 |