Home > Back-end >  Why is this bit field output is wrong
Why is this bit field output is wrong

Time:10-24


# include
using namespace std;
Enum Wordsize {thirty_two sixty_four};
Enum He {Single, Double, Four};


The class CPU {
Public:
CPU (unsigned hz, Wordsize Wordsize, He He, bool ht) : Hertz (hz), Wordsize (Wordsize), He (He), ht (ht) {};
void show();
Private:
Unsigned hz: 13;
Wordsize Wordsize: 1;
He He: 2;
Bool ht: 1;
};
Void CPU: : show () {
cout<" The frequency of this computer is: "& lt; The switch (wordsize) {
Case thirty_two: cout<" This computer word length is: "& lt; <" 32 words "& lt; & lt; Endl;
break;
Case sixty_four: cout<" This computer word length is: "& lt; <" 64 words "& lt; break;
}
The switch (he) {
Case in use: cout<" This computer auditing is: "& lt; <" Single-core "& lt; break;
Case Double: cout<" This computer auditing is: "& lt; <" Dual-core "& lt; break;
Case Four: cout<" This computer auditing is: "& lt; <" Quad-core "& lt; break;
}
cout<(ht?" Support multithreading ":" does not support multithreading ") & lt; }
Int main () {
A CPU (3000, sixty_four, Four, true);
A.s how ();
coutreturn 0;
}

CodePudding user response:

Should not be 13 + 1 + 2 + 1=17 three bytes
  • Related