sunao furukawa
2009-03-18 02:24:59 UTC
$B!!***@n$H?=$7$^$9!#(B
$B!!0J2<$N$h$&$J%W%m%0%i%`$r(BVisual C++ 2008 express edition$B$G%3%s%Q%$%k$7$h$&$H$7$F$$$k$N$G$9$,!"%G%P%C%0$NCJ3,$GCfCG$7$F$$$^$9!#$$$m$$$m$d$C$F$_$?$N$G$9$,860xITL@$N%G%P%C%0$NCfCG$K$J$C$F$7$^$&$3$H$b$"$j$^$7$?!#FC$K(Bmain$B$NCJ3,$G$N>e<j$J%W%m%0%i%`$N=q$-J}$r65$($F$/$@$5$$!#(B
$B!c=PNO!d(B
------ $B%S%k%I3+;O(B: $B%W%m%8%'%/%H(B: h17spring001, $B9=@.(B: Debug Win32 ------
$B%3%s%Q%$%k$7$F$$$^$9(B...
h17spring001.cpp
.\h17spring001.cpp(45) : error C2664: 'print_string' : 3 $BHVL\$N0z?t$r(B
'CHARPROF **' $B$+$i(B 'CHARPROF *' $B$KJQ49$G$-$^$;$s!#(B($B?7$7$$5!G=(B ; $B%X%k%W$r;2>H(B)
$B;X<($5$l$?7?$O4XO"$,$"$j$^$;$s!#JQ49$K$O(B reinterpret_cast$B!"(BC $B%9%?%$%k(B
$B%-%c%9%H$^$?$O4X?t%9%?%$%k$N%-%c%9%H$,I,MW$G$9!#(B
$B%S%k%I%m%0$O(B "file://c:\Users\sunao\Documents\Visual Studio
2008\Projects\h17spring001\h17spring001\Debug\BuildLog.htm" $B$KJ]B8$5$l$^$7$?!#(B
h17spring001 - $B%(%i!<(B 1$B!"7Y9p(B 0
========== $B%S%k%I(B: 0 $***@5>o=*N;!"(B1 $B<:GT!"(B0 $B99?7ITMW!"(B0 $B%9%-%C%W(B ==========
$B!c%W%m%0%i%`!d(B
// h17spring001.cpp : $B%a%$%s(B $B%W%m%8%'%/%H(B $B%U%!%$%k$G$9!#(B
#include "stdafx.h"
#include <stdio.h>
using namespace System;
typedef struct{ char char_p;
int char_w;
} CHARPROF;
void print_string(int,char *[],CHARPROF *,int);
int word_width(char *,CHARPROF *);
void print_string(int line_w, char *str_list[], CHARPROF *char_list, int
space_w){
int cur_w = 0, str_w , idx;
for(idx = 0; str_list[idx] != NULL; idx++){
str_w = word_width(str_list[idx],char_list);
cur_w += str_w;
if(cur_w == str_w)
printf("%s", str_list[idx]);
else{
cur_w += space_w;
if(cur_w <= line_w)
printf(" %s",str_list[idx]);
else{
cur_w = str_w;
printf("\n%s",str_list[idx]);
}
}
}
putchar('\n');
}
int word_width(char *str, CHARPROF *char_list){
int print_w = 0,idx;
while(*str !='\0'){
for(idx = 0; *str != char_list[idx].char_p; idx++);
print_w += char_list[idx].char_w;
str++;
}
return print_w;
}
int main(void)
{
CHARPROF *test0001;
char *z[10]={"Hello World"};
print_string(80,z,&test0001,1);
}
$B!!0J2<$N$h$&$J%W%m%0%i%`$r(BVisual C++ 2008 express edition$B$G%3%s%Q%$%k$7$h$&$H$7$F$$$k$N$G$9$,!"%G%P%C%0$NCJ3,$GCfCG$7$F$$$^$9!#$$$m$$$m$d$C$F$_$?$N$G$9$,860xITL@$N%G%P%C%0$NCfCG$K$J$C$F$7$^$&$3$H$b$"$j$^$7$?!#FC$K(Bmain$B$NCJ3,$G$N>e<j$J%W%m%0%i%`$N=q$-J}$r65$($F$/$@$5$$!#(B
$B!c=PNO!d(B
------ $B%S%k%I3+;O(B: $B%W%m%8%'%/%H(B: h17spring001, $B9=@.(B: Debug Win32 ------
$B%3%s%Q%$%k$7$F$$$^$9(B...
h17spring001.cpp
.\h17spring001.cpp(45) : error C2664: 'print_string' : 3 $BHVL\$N0z?t$r(B
'CHARPROF **' $B$+$i(B 'CHARPROF *' $B$KJQ49$G$-$^$;$s!#(B($B?7$7$$5!G=(B ; $B%X%k%W$r;2>H(B)
$B;X<($5$l$?7?$O4XO"$,$"$j$^$;$s!#JQ49$K$O(B reinterpret_cast$B!"(BC $B%9%?%$%k(B
$B%-%c%9%H$^$?$O4X?t%9%?%$%k$N%-%c%9%H$,I,MW$G$9!#(B
$B%S%k%I%m%0$O(B "file://c:\Users\sunao\Documents\Visual Studio
2008\Projects\h17spring001\h17spring001\Debug\BuildLog.htm" $B$KJ]B8$5$l$^$7$?!#(B
h17spring001 - $B%(%i!<(B 1$B!"7Y9p(B 0
========== $B%S%k%I(B: 0 $***@5>o=*N;!"(B1 $B<:GT!"(B0 $B99?7ITMW!"(B0 $B%9%-%C%W(B ==========
$B!c%W%m%0%i%`!d(B
// h17spring001.cpp : $B%a%$%s(B $B%W%m%8%'%/%H(B $B%U%!%$%k$G$9!#(B
#include "stdafx.h"
#include <stdio.h>
using namespace System;
typedef struct{ char char_p;
int char_w;
} CHARPROF;
void print_string(int,char *[],CHARPROF *,int);
int word_width(char *,CHARPROF *);
void print_string(int line_w, char *str_list[], CHARPROF *char_list, int
space_w){
int cur_w = 0, str_w , idx;
for(idx = 0; str_list[idx] != NULL; idx++){
str_w = word_width(str_list[idx],char_list);
cur_w += str_w;
if(cur_w == str_w)
printf("%s", str_list[idx]);
else{
cur_w += space_w;
if(cur_w <= line_w)
printf(" %s",str_list[idx]);
else{
cur_w = str_w;
printf("\n%s",str_list[idx]);
}
}
}
putchar('\n');
}
int word_width(char *str, CHARPROF *char_list){
int print_w = 0,idx;
while(*str !='\0'){
for(idx = 0; *str != char_list[idx].char_p; idx++);
print_w += char_list[idx].char_w;
str++;
}
return print_w;
}
int main(void)
{
CHARPROF *test0001;
char *z[10]={"Hello World"};
print_string(80,z,&test0001,1);
}