Undeclared Identifier
I am confused, I thought I declared c with
<string>
. I tried to
int c
before an after
{
to no aval. Could someone explain what I am doing wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
cout << ccccccccc ++ ++ << endl;
cout << cc ++ ++ << endl;
cout << cc ++++++++++++++ ++++++++++++++ << endl;
cout << cc ++++++++++++++ ++++++++++++++ << endl;
cout << cc ++ ++ << endl;
cout << ccccccccc ++ ++ << endl;
return 0;
}
|
The most obvious thing is you're missing quotes around the strings you are listing.
To make your code work, all you need is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
cout << "ccccccccc ++ ++ " << endl;
cout << "cc ++ ++ " << endl;
cout << "cc ++++++++++++++ ++++++++++++++" << endl;
cout << "cc ++++++++++++++ ++++++++++++++" << endl;
cout << "cc ++ ++ " << endl;
cout << "ccccccccc ++ ++ " << endl;
return 0;
}
|
Topic archived. No new replies allowed.