Help again!

closed account (ENhkSL3A)
Can you all help me out again. I'm getting a ton of errors. My teach was EXTREMELY vague in the instructions. So I am clueless as to how bad of a job I'm doing. The main errors I am getting are:
KNSP1.cpp:17:48: error: use of undeclared identifier 'integer'
KNSP1.cpp:18:60: error: expected ')' and I get this with '(' It usually refers to the '()' after size of.
KNSP1.cpp:18:82: error: use of undeclared identifier 'counter'; did you mean 'count'?

P.S. Thanks to those of you that helped me the other day! It was really appreciated!

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
26
27
28
29
30
#include <iostream>
#include <cfloat>

using namespace std;

int main()

{
cout<< "Program 2A" << endl;
cout<< "Kaitlin Stevers" << endl;
cout<< "September 5, 2016" << endl;

cout<< "Demonstratinn of variable types, storage sizes and max/min values." << endl;

int count = 42
cout<< " rate \t\tshort \t\t\t\t" << sizeof(short) << "\t\t" << rate << "\t\t" << SHRT_MIN << " to " << SHRT_MAX << "n" << endl;
cout<< " count \t\tinteger \t\t\t\t" << sizeof(integer) << "\t\t" << integer << "\t\t" << INT_MIN << " to " << INT_MAX << "\n" << endl;
cout<< " counter \t\tlong integer \t\t\t\t" << sizeof(long integer) << "\t\t" << counter << "\t\t" << LONG_MIN << " to " << LONG_MAX << "\n" << endl;
cout<< " totalint \t\tunsigned integer \t\t\t\t" << sizeof(unsigned integer) << "\t\t" << totalint << "\t\t" << UINT_MAX << "\n" endl;
cout<< " distance \t\tfloating point \t\t\t\t" << sizeof(floating point) << "\t\t" << distance << "\t\t" << FLT_MIN << " to " << FLT_MAX << "\n" << endl;
cout<< " accuracy \t\tfloating point double \t\t\t\t" << sizeof(floating point double) << "\t\t" << accuracy << "\t\t" << DBL_MIN << " to " << DBL_MAX << "\n" << endl;
cout<< " temp \t\tfloating point long double \t\t\t\t" << sizeof(floating point long double) << "\t\t" << temp << "\t\t" << LDBL_MIN << " to " << LDBL_MAX << "\n" << endl;
charsymbol = 'r';
cout<< " charsymbol \t\tcharacter \t\t\t\t" << sizeof(character) << "\t\t" << charsymbol << "\t\t" << CHAR_MIN << " to " << CHAR_MAX << "\n" << endl;
charsymbol = 3;
cout<< " charsymbol \t\tcharacter \t\t\t\t" << sizeof(character) << "\t\t" << charsymbol << "\t\t" << CHAR_MIN << " to " << CHAR_MAX << "\n" <<endl;
cout<< " flag \t\tboolean \t\t\t\t" << sizeof(boolean) << "\t\t" << flag << "\t\t" << "0" << " to " << "1" << "\n" << endl;
return 0;
}

You haven't defined counter. You have only definedcount

Integer should beint
closed account (ENhkSL3A)
I didn't know at all what I was doing earlier. Here is my new code

[code]

#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;
}
[code]
closed account (ENhkSL3A)
<code>

#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;
}
</code>
kns2872,

The program in your OP has the right idea once you clean up the errors. The variables: rate, integer, counter, totalint, distance, accuracy and temp are all undefined variables. Not sure what you wanted to do with these variables. So, for now I just commented them out until a later time when I understand how you wanted to use them. Line 25 tries to redefine line 23. Make those two different names and give each a type of char for the variables charsymbol and the 3 on line 25 should be enclosed in at least single quotes snice it should be of type char.

Here are the changes I made. I added some formatting to make the output easier to read. Compare it to your original program and notice the differences:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
	cout << "Program 2A" << endl;
	cout << "Kaitlin Stevers" << endl;
	cout << "September 5, 2016" << endl;

	cout << "Demonstratinn of variable types, storage sizes and max/min values." << endl;

	int count = 42;
	cout << "\n name\t\ttype\t\t\t   storage size\t\tmin/max values\n" << endl;

	cout << left << setw(10) << " rate \t\tshort \t\t\t\t" << setw(2) << sizeof(short) << "\t" << /*rate <<*/ "\t" << SHRT_MIN << " to " << SHRT_MAX << "n" << endl;
	cout << left << setw(10) << " count \t\tint \t\t\t\t" << setw(2) << sizeof(int) << "\t" << /*int <<*/ "\t" << INT_MIN << " to " << INT_MAX << "\n" << endl;
	cout << left << setw(10) << " counter \tlong int \t\t\t" << setw(2) << sizeof(long int) << "\t" << /*counter <<*/ "\t" << LONG_MIN << " to " << LONG_MAX << "\n" << endl;
	cout << left << setw(10) << " totalint \tunsigned int \t\t\t" << setw(2) << sizeof(unsigned int) << "\t" << /*totalint <<*/ "\t" << UINT_MAX << "\n" << endl;
	cout << left << setw(10) << " distance \tfloating point \t\t\t" << setw(2) << sizeof(float) << "\t" << /*distance <<*/ "\t" << FLT_MIN << " to " << FLT_MAX << "\n" << endl;
	cout << left << setw(10) << " accuracy \tfloating point double\t\t" << setw(2) << sizeof(double) << "\t" << /*accuracy <<*/ "\t" << DBL_MIN << " to " << DBL_MAX << "\n" << endl;
	cout << left << setw(10) <<  " temp \t\tfloating point long double \t" << setw(2) << sizeof(long double) << "\t" << /*temp <<*/ "\t" << LDBL_MIN << " to " << LDBL_MAX << "\n" << endl;
	char charsymbol = 'r';
	cout << " charsymbol \tcharacter \t\t\t" << sizeof(char) << "\t" << charsymbol << "\t" << CHAR_MIN << " to " << CHAR_MAX << "\n" << endl;
	char charsymboli = '3';
	cout << left << setw(10) << " charsymbol \tcharacter \t\t\t" << sizeof(char) << "\t" << charsymboli << "\t" << CHAR_MIN << " to " << CHAR_MAX << "\n" << endl;
	cout << left << setw(10) << " flag \t\tboolean \t\t\t" << sizeof(bool) << "\t" << /*flag <<*/ "\t" << "0" << " to " << "1" << "\n" << endl;
 

Hope that helps,

Andy

P.S. If you write your own tags to surround your code it starts with code surrounded with square brackets and the closing is /code surrounded by square brackets. You missed the fordward slash o your second code posting. Or you can highlight your code and press the <>to the right of the message box.
closed account (ENhkSL3A)
Thank you so much Andy! Great help :)
closed account (ENhkSL3A)
Hey andy can you help me with my newest post. http://www.cplusplus.com/forum/general/199078/
Hello kns2872,

Yes just posted there.

Andy
Topic archived. No new replies allowed.