#include
#include
int main()
{
char *movie[5];
movie[0]= \"The Davinci Code\";
movie[1]= \"The Hill Have eyes\";
movie[2]= \"Mission Impossible 3\";
movie[3]= \"Silent Hill\";
movie[4]= \"Ice age 2\";
int c=0;
for (int k=0; k<5; k++)
{
for(int i=0; i
if ( *movie[k]== \'c\'||*movie[k]==\'C\' )
{
cout<<\"c\"<
}
}
}
cout<<\"c總計出現有\"<
}
2006-05-19 15:34:37 · 2 個解答 · 發問者 ? 1 in 電腦與網際網路 ➔ 程式設計
kui 請你再幫個忙
http://tw.knowledge.yahoo.com/question/?qid=1306051911689
2006-05-19 17:54:20 · update #1
#include
using namespace std;
#include
int main()
{
char *movie[5];
movie[0]= "The Davinci Code";
movie[1]= "The Hill Have eyes";
movie[2]= "Mission Impossible 3";
movie[3]= "Silent Hill";
movie[4]= "Ice age 2";
int c=0;
for (int k=0; k<5; k++)
{
for(int i=0; i
if ( movie[k][i]== 'c' || movie[k][i]=='C' ) // 或者你喜歡 *(movie[k]+i)== 'c' || *(movie[k]+i)=='C'
{
cout<<"c"<
}
}
}
cout<<"c總計出現有"<
}
2006-05-19 21:37:49 補充:
最上面你還是用你原來的#include
2006-05-19 17:18:05 · answer #1 · answered by chan 5 · 0⤊ 0⤋
char *movie[5]; ---> 有點奇怪
指標要這樣做
=================================================
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
char movie[]="The Davinci Code The Hill Have eyes Mission Impossible 3 Silent Hill Ice age 2";
char *pmovie=movie;
int c=0;
for(int i=0;i
if (*(pmovie+i)=='c'||*(pmovie+i)=='C')
{
cout<<"c"<
}
}
cout<<"c總計出現有"<
return EXIT_SUCCESS;
}
2006-05-19 17:19:40 · answer #2 · answered by puppy 5 · 0⤊ 0⤋