I have written a program that work as supposed to, except the output needs to be in 2 cols. instead of 1 col. in console. Could someone help me to format this?
Below is the program and the output I need to change. 14.14.cpp : Defines the entry point for the console application.
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <fstream>
using std::cout;
using std::endl;
using std::cerr;
using std::setw;
using std::ofstream;
using std::ifstream;
int main()
{
ofstream outFile("datasize.dat");
cout << "Data type" << setw(16) << "Size\nchar"
<< setw(21) << sizeof(char)
<< "\nunsigned char" << setw( 12 ) << sizeof(unsigned char)
<< "\nshort int" << setw( 16 ) << sizeof(short int)
<< "\nunsigned short int" << setw( 7 ) << sizeof(unsigned short)
<< "\nint" << setw( 22 ) << sizeof(int) << '\n';
cout << "unsigned int" << setw( 13 ) << sizeof(unsigned)
<< "\nlong int" << setw( 17 ) << sizeof( long )
<< "\nunsigned long int" << setw( 8 ) << sizeof(unsigned long int)
<< "\ndouble" << setw ( 20 ) << sizeof (double)
<< "\ndouble" << setw ( 19 ) << sizeof (double)
<< "\nlong double" << setw (14) << sizeof (long double)<< endl;
return 0;
}
Data type Size
char 1
unsignedchar 1
shortint 2
unsignedshortint 2
//need to split col. here.:cheesy: :cheesy: :cheesy: :cheesy:
int 4
unsignedint 4
longint 4
unsignedlongint 4
double 8
double 8
longdouble 8
Press any key to continue . . .