This line doesn’t do the right thing:
ch += 32*j;
You want to count by 32, that’s either
ch += 32;
or
ch = i + 32*j;
I strongly recommend making the numeric and character values match during your output. So change
cout << setw(3) << i+(32*j) << " " << setw(6) << ch;
to
cout << setw(3) << int(ch) << " " << setw(6) << ch;
Related Posts:
- std::string to char*
- Conversion from string to char – c++
- What is an unsigned char?
- How to read a file line by line or a whole text file at once?
- How to convert a char array to a string?
- finding dll for “The specified module could not be found”
- Convert an int to ASCII character
- How can I clear console
- How to go from fopen to fopen_s
- undefined reference to WinMain@16 (codeblocks)
- “X does not name a type” error in C++
- ‘cout’ was not declared in this scope
- Windows 7 exception code: 0xc0000409
- Difference between ‘strcpy’ and ‘strcpy_s’?
- make: g++: Command not found
- streambuf::xsgetn and state flags
- ‘cout’ was not declared in this scope
- How to convert a single char into an int [duplicate]
- std::string to char*
- VC++ fatal error LNK1168: cannot open filename.exe for writing
- How to convert a std::string to const char* or char*
- Why would we call cin.clear() and cin.ignore() after reading input?
- getline() does not work if used after some inputs
- MinGW: “gcc is not recognized as an internal or external command”
- Reading from text file until EOF repeats last line
- How can I convert const char* to string and then back to char*?
- LNK1168: cannot open debug\file.exe for writing
- Convert char* to string C++
- VC++ fatal error LNK1168: cannot open filename.exe for writing
- How do I add the MinGW bin directory to my system path?
- Run C++ in command prompt – Windows
- How to get Current Directory?
- Cannot open Windows.h in Microsoft Visual Studio
- How to convert ASCII value into char in C++?
- The program can’t start because libgcc_s_dw2-1.dll is missing
- Is there a replacement for unistd.h for Windows (Visual C)?
- Comparing the values of char arrays in C++
- Convert char array to single int?
- cin.eof() functionality
- CMake : C and CXX compiler identification is unknown Win10 CMakeGUI
- How to sort with a lambda?
- Converting string to ASCII
- The difference between cin.ignore and cin.sync
- casting int to char using C++ style casting
- How to print (using cout) a number in binary form?
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- LPCSTR, LPCTSTR and LPTSTR
- Xcode 11.1: iostream’ file not found
- What’s the difference between while(cin) and while(cin >> num)
- operator << must take exactly one argument
- C++ 2d char array to string
- Using cin for char array
- How do I simply compare characters in C++?
- Using cin to input a single letter into a char
- REGSVR32: the module “xxxxx.dll” failed to load … dependent assembly could not be found
- How to solve “Unresolved inclusion:
” in a C++ file in Eclipse CDT? - How to throw a C++ exception
- What is meant by Resource Acquisition is Initialization (RAII)?
- When to use extern “C” in simple words? [duplicate]
- What does the explicit keyword mean?
- How to fix ‘No match for operator[]’ error (c++)
- std::cin.getline( ) vs. std::cin
- C++ error: terminate called after throwing an instance of ‘std::bad_alloc’
- Undefined reference to vtable
- How to get current time and date in C++?
- ‘vector’ in namespace ‘std’ does not have a template type
- Floating Point Exception C++ Why and what is it?
- Issue with std::stol – ‘std::invalid_argument’ what(): stol
- Writing a LinkedList destructor?
- Creating a copy constructor for a linked list
- Is there a tab equivalent of std::endl within the standard library?
- Using the fstream getline() function inside a class
- Missing vc_runtimeminimum_x86.msi and installation won’t work
- What is the difference between isdigit() and isnumber()?
- C++ delete vector, objects, free memory
- How to convert C++ Code to C
- Multiple OR or AND conditions in IF statement
- What does it mean double free detected in tcache 2 while using mpz?
- fatal error LNK1169: one or more multiply defined symbols found in game programming
- How to initialize a vector of pointers
- C++: Using ifstream with getline();
- Random not declared in scope
- What does the “Expected ‘(‘ for function-style cast or type construction” error mean?
- LINK : fatal error LNK1561: entry point must be defined ERROR IN VC++
- Win32 Console Application
- What does the fpermissive flag do?
- https://stackoverflow.com/questions/3865946/error-generic-array-creation
- Destructor for a doubly-linked list that points to its value
- cin.ignore(numeric_limits
::max(), ‘\n’) - LLVM Compiler 2.0: Warning with “using namespace std;”
- C++ operator+ and operator+= overloading
- In c++ what does a tilde “~” before a function name signify?
- How to get the ASCII value in JavaScript for the characters [duplicate]
- glibc detected : double free or corruption
- What is the best way to develop a C++ web application?
- How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?
- Throwing out of range exception in C++
- Is null reference possible?
- Link error “undefined reference to `__gxx_personality_v0′” and g++ [duplicate]
- How to use bitmask?