use of undeclared identifier 'charsymbol'

closed account (ENhkSL3A)
I'm getting the errors learning.cxx:20:9: error: use of undeclared identifier 'char symbol'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  
#include <cfloat>
#include <iostream>
using namespace std;


int main()
{
	charsymbol = 'r' ;
	charsymbol = 3 ;
	cout<< "Demonstration of variable types, storage size and min/max values." << endl;
	cout<< "Name    Type    Memory in bytes    Value    Range of values" << endl;
	cout<< "rate    short    " << sizeof(SHRT_MIN) << "  to   " << sizeof(SHRT_MAX) << endl;
	cout<< "count    integer    " << sizeof(INT_MIN) << "  to   " << sizeof(INT_MAX) << endl;
	cout<< "Counter  long integer  " << sizeof(LONG_MIN) << "  to   " << sizeof(LONG_MIN) << endl;
	cout<< "totalint  unsigned integer  0  to   " << sizeof(UINT_MAX) << endl;
	cout<< "Distance    floating point  " << sizeof(FLT_MIN) << "  to   " << sizeof(FLT_MAX) << endl;
	cout<< "accuracy   floating point double " << sizeof(DBL_MIN) << "  to   " << sizeof(DBL_MAX) << endl;
	cout<< "temp  floating point long double " << sizeof(LDBL_MIN) << " to  " << sizeof(LDBL_MAX) << endl;
	cout<< charsymbol << sizeof(CHAR_MIN) << "  to   " << sizeof(CHAR_MAX) << endl;
	cout<< charsymbol << sizeof(CHAR_MIN) << "  to   " << sizeof(CHAR_MAX) << endl;
	cout<< "Flag    boolean   1  to   2" << endl;
	
	return 0;
}
Look closely at your code it contains "charsymbol" not "char symbol" note the lack of the space.

closed account (ENhkSL3A)
Sorry, my professor didn't put a space so I didn't realize it needed one. Thank you. She messes up like that all the time causing us students to screw up and not have a clue why! Gahhh! Thank you!
closed account (48T7M4Gy)
Also be careful with the cout's. Should be cout << symbol and
not cout << charsymbol or cout char symbol

Just to confuse you though, you could call the char variable charsymbol which means line 9 would be
char charsymbol = 'r'; - that would be legal

and the cout would be cout << charsymbol etc but it would still not be cout << char charsymbol etc:)
Last edited on
closed account (ENhkSL3A)
Thanks :)
Topic archived. No new replies allowed.