Home > Back-end >  The Dutch national flag problem
The Dutch national flag problem

Time:12-27

I think no problem my logic
Where is grammar problems lead to such
# include "iostream"
# include "cstrings
"using namespace std;

Int main ()
{
Char q []={" Red "};
Char w []={" White "};
Char [] e={} "Blue";
Char tidai [100].
Int a, b, c;
a=0; b=0; C=0;
Char guoqi [256].
Char fenge [2]={" "};
Char * weizhi.
Cin> Guoqi.










Weizhi=strtok (guoqi, "");
If (STRCMP (weizhi, q)==0)
{
a++;
}
If (STRCMP (weizhi, w)==0)
{
b++;
}
If (STRCMP (weizhi, e)==0)
{
c++;
}
While (weizhi!=NULL)
{
Weizhi=strtok (NULL, "");
If (STRCMP (weizhi, q)==0)
{
a++;
}
If (STRCMP (weizhi, w)==0)
{
b++;
}
If (STRCMP (weizhi, e)==0)
{
c++;
}
}







int i,j;
for(i=0; i<3; I++)
{
The switch (I)
{
Case 0: j=a; Strcpy (tidai, "Red"); break;
Case 1: j=b; Strcpy (tidai, "White"); break;
Case 2: j=c; Strcpy (tidai, "Blue"); break;

}
For (; J> 0; J -)
{
Cout}
}

}

CodePudding user response:

The problem is that the substring cannot use strtok to get in while use STRCMP and such operations to him?
  • Related