0
Not get desired output in c++
#include <iostream> using namespace std; int main() { cout << " c \n"; cout << " + \n"; cout <<" + "; return 0; } Why I am not getting output which is C + + It is question from c++ course lesson 3
4 Answers
+ 4
#include <iostream>
using namespace std;
int main()
{
cout << "C\n";
cout << "+\n";
cout <<"+";
return 0;
}
I think you should remove the space and use a capital C.
+ 2
you really don't need all those cout. You can condense it to one line.
cout<<"C\n+\n+";
0
here is something to explore. Google 'iomanip setw()' and 'C++ for-each loop' to learn more...
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int tab = 10;
for(auto c : "PYTHON")
cout<<setw(tab)<<c<<'\n';
}