+ 1

The given program outputs "C++". Change the code to output each character on a new line, resulting in: C + +

3rd Jan 2022, 4:09 AM
AJ Nicole P. Aquino
2 Answers
0
#include <iostream> #include <cstring> const char* cpp = "C++"; for (int i = 0; i < std::strlen(cpp); i++) std::cout << cpp[i] << "\n"; This should iterate to each character in the defined string literal
3rd Jan 2022, 4:57 AM
Lyptox
Lyptox - avatar
0
22nd Jun 2022, 5:59 PM
ABEBU WONDYFRAW