-3
2つの文字列の一致する文字を検索し、残りの文字列と比較するN個の配列を持つプログラムを作成しようとしています。コードは次のとおりです。n文字列からサブ文字列を見つける方法
int main()
{
int a, b, n;
char sir[50];
printf("Number of strings: "); scanf("%d", &n);
if(n<=1){
printf("The program cannot run without at least 2 strings!");
} else {
printf("The program will run for %d strings.\n", n);
printf("\nString number 1: ");
scanf("%s", &sir);
std::string first(sir);
cout << first;
for(a=2; a<=n;){
printf("\nString number %d: ", a);
scanf("%s", &sir);
std::string temp(sir);
if(!!!first.contains(temp)!!!){
a++;
} else {
printf("Program stops the substring doesn't match with the last string.");
return 0;
}
}
}
}
私はどこに!!!私はその部分をコード化する方法を知らない。
:次の行は、仕事をする必要がありますか? –
あなたはどんな問題を経験していますか?あなたのコードは、あなたがそれをすることを期待していないことは何ですか? –
std :: coutとstd :: cin、xDの使い方が分かりません。はじめまして.... – Cravenica