Home > Back-end >  Loop statement last a symbol is always more output what should I do
Loop statement last a symbol is always more output what should I do

Time:09-24

# include & lt; Iostream>
# include & lt; Cmath>
using namespace std;
Char value [100].
Int output_valuetable (int x)
{
Int I, j, t;
For (I=x; I> 0; I -)
{
Cout<" \ t "& lt; <" P "& lt; }
Cout<" \ t "& lt; <" T/F "& lt; for(i=0; I<(int) pow (2 * 1.0 x); I++)
{
Cout<" \ t ";
T=I;
for(j=0; J{
If (t % 2==0)
{
Cout<" F "& lt; <" \ t ";
} the else
{
Cout<" T "& lt; <" \ t ";
}
T/t=2;
}
Cout}

}
Int output_zhq (int x)
{
Int I, j, k;
for(i=0; I<(int) pow (2 * 1.0 x); I++)
{
K=I;
If (value [I]=='F')
{
Cout<" (";
For (j=x; j> 0; J -)
{

If (k % 2==0)
{
If (j==1)
{
Cout<" P "& lt; } the else
{cout<" P "& lt; } the else
{
If (j==1)
{
Cout<" ~ P "& lt; } the else
{cout<" ~ P "& lt; }

K=k/2;

}
Cout<" ) ";
Cout<" ^ ";
}
}
}
Int output_zxq (int x)
{
Int I, j, k;
for(i=0; I<(int) pow (2 * 1.0 x); I++)
{
K=I;
If (value [I]=='T')
{
Cout<" (";
For (j=x; j> 0; J -)
{

If (k % 2==0)
{
If (j==1)
{
Cout<" ~ P "& lt; } the else
{cout<" ~ P "& lt; } the else
{
If (j==1)
{
Cout<" P "& lt; } the else
{cout<" P "& lt; }
K=k/2;
}
Cout<" ) ";
Cout<" V ";
}

}
}

Int main ()
{
Int I, n;
//char a, [100].
Cout<" Please enter the number argument: "& lt; Cin> n;
Cout<" Please enter the expression of true value: "& lt; for(i=0; I<(int) pow (2, n); I++)
{
Cin> The value [I];
}
Cout<" True value table is as follows: "& lt; Output_valuetable (n);
Cout<" \ n ";
Cout<" The main conjunctive normal form is as follows: "& lt; Output_zhq (n);
Cout<" \ n ";
Cout<" The main disjunctive normal form is as follows: "& lt; Output_zxq (n);
Coutreturn 0;
}
After the operation is always more output a ^ or V,
Why use cout<" B \ "; Does not delete the last character;

CodePudding user response:

Use string record the answer, and then delete redundant in string behind
  • Related