English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

#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\"< c=c++;
}
}
}
cout<<\"c總計出現有\"< return 0;
}

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

2 個解答

#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"< c++;
}
}
}
cout<<"c總計出現有"< return 0;
}

2006-05-19 21:37:49 補充:
最上面你還是用你原來的#include 你的compiler和我的不一樣

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"< c++;
}
}
cout<<"c總計出現有"< system("PAUSE");
return EXIT_SUCCESS;
}

2006-05-19 17:19:40 · answer #2 · answered by puppy 5 · 0 0

fedest.com, questions and answers