Answers for "how to read in spaces in c++ array"

1

print array elements with space c++

#include <iostream> // cout
#include <iomanip> // setw
int main()
{
    int array[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };       
    for (auto n : array)
    {
        std::cout << std::setw(4) << n;
    }
}
Posted by: Guest on October-31-2020
-1

read string with spaces in c++

#include <string>
string s;
getline(cin, s);
Posted by: Guest on June-08-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language