Ok first let me just let you know I'm just starting to learn C++ so if this seems like a stupid question I'm sorry. But I guess we can't all be masters our first day. Ok so here is the prob....
The book I'm learning from (C++ Programming 101 by Greg Perry) wants me to:
Write a program that defines the 10 digits, 0 through 9, as literals ZERO through NINE. Add these 10 defined digits and store the sum in a variable named 'total' and print to screen the results.
I did another program sort of like this and it ran perfect it's first time compiled. But I have no clue what to do here. Here is the source code I've typed so far so you can see if I'm even on the right track. Oh and this code is just to get the literals to print I havn't done the part to add them yet cause I can't even get this to work. Well any suggestions or solutions would be great thanks.
---Source Code---
Code://Review Exercises Pg 97 #3 #include <iostream.h> #define 0 "ZERO" #define 1 "ONE" #define 2 "TWO" #define 3 "THREE" #define 4 "FOUR" #define 5 "FIVE" #define 6 "SIX" #define 7 "SEVEN" #define 8 "EIGHT" #define 9 "NINE" int main() { cout << 0"\n"; cout << 1"\n"; cout << 2"\n"; cout << 3"\n"; cout << 4"\n"; cout << 5"\n"; cout << 6"\n"; cout << 7"\n"; cout << 8"\n"; cout << 9"\n"; system ("Pause"); return 0; }