Home > Back-end >  C a few characters of how to set up an integer
C a few characters of how to set up an integer

Time:10-11

C + + how to set up an integer of a few characters, who have a c + + based knowledge

CodePudding user response:

It is as you say, cout output problem of the width of the integer
#include
#include
using namespace std;
Int main () {
Cout. Width (10);
Cout. The fill (' * ');
cout <12 & lt; //the second
Int I=3;
cout return 0;
}

If the int account for a few bytes of memory, so you cannot be set up, this is the problem that the operating system and compiler
Under Windows int and long is 4 bytes, long long is 8 bytes
Int under Linux system is 4 bytes, long have a plenty of 4 or 8 (different CPU and system), long long is 8 bytes

CodePudding user response:

The compiler is good
Unless the compilers provide command to modify the parameters (such as GCC - XXX XXX can specify the type of bytes), or a corresponding macro definition (such as WIN32 WIN64 such macro may be defined), otherwise there is no way,
  • Related