朱「あ…」
浩介「ああっ、お前……なにすんだよ……」
朱「ご、ごめん」

保坂先輩www



bool isLittleEndian(){
const WORD endian = 0x1234;
return *((BYTE*)&endian) == 0x34;
}
C:\Documents and Settings\<User Name>\Recent
#include <windows.h>
#include <shlobj.h>
#pragma comment ( lib, "shell32.lib" )
int _tmain( int argc, _TCHAR* argv[] ){
TCHAR path[MAX_PATH+1];
WIN32_FIND_DATA findData;
HANDLE hFind;
if( SHGetSpecialFolderPath( NULL, path, CSIDL_RECENT, FALSE ) ){
_tprintf_s( _T("%s\n"), path );
_tcscat_s( path, _T("\\*.*") );
hFind = FindFirstFile( path, &findData );
path[_tcslen( path )-3] = 0;
do{
_tprintf_s( _T("%s%s\n"), path, findData.cFileName );
} while ( FindNextFile( hFind, &findData ) );
if( hFind != INVALID_HANDLE_VALUE ){
FindClose( hFind );
}
}
system( "pause" );
return 0;
}
#include <windows.h>
#include <shlobj.h>
#pragma comment ( lib, "shell32.lib" )
int _tmain( int argc, _TCHAR* argv[] ){
FILE* pFile = NULL;
_tfopen_s( &pFile, _T("RecentList.txt"), _T("wb") );
if( !pFile ){
_tprintf_s( _T("Cannot open file" ) );
system( "pause" );
return 0;
}
WORD BOM = 0xFEFF;
fwrite( &BOM, sizeof( WORD ), 1, pFile );
TCHAR path[MAX_PATH+1];
WIN32_FIND_DATA findData;
HANDLE hFind;
if( SHGetSpecialFolderPath( NULL, path, CSIDL_RECENT, FALSE ) ){
_ftprintf_s( pFile, _T("%s\n"), path );
_tcscat_s( path, _T("\\*.*") );
hFind = FindFirstFile( path, &findData );
path[_tcslen( path )-3] = 0;
do{
_ftprintf_s( pFile, _T("%s%s\n"), path, findData.cFileName );
} while ( FindNextFile( hFind, &findData ) );
if( hFind != INVALID_HANDLE_VALUE ){
FindClose( hFind );
}
}
fclose( pFile );
return 0;
}
~yvals.h(513) : error C2143: syntax error : missing ';' before 'namespace'這樣莫名其妙的錯誤訊息
error C2061: syntax error : identifier 'DWORD'等不可能會出現的錯誤
bool isPrime( const DWORD n ){
if( n < 2 )
return FALSE;
if( n == 2 || n == 3 )
return TRUE;
if( !(n%2) || !(n%3) )
return FALSE;
DWORD limit = (DWORD)sqrt( (double)n );
for( DWORD i=5, gap=2; i<=limit; i+=gap, gap=6-gap ){
if( !(n%i) ){
return FALSE;
}
}
return TRUE;
}bool* eratosthenes( const DWORD n ){
bool* pPrime = new bool[n+1];
pPrime[0] = pPrime[1] = FALSE;
for( DWORD i=2; i<=n; ++i ){
pPrime[i] = TRUE;
}
DWORD limit = (DWORD)sqrt( (double)n );
for( DWORD i=2; i<limit; ++i ){
if( pPrime[i] ){
for( DWORD j=i*i; j<=n; j+=i ){
pPrime[j] = FALSE;
}
}
}
return pPrime;
}