![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 550
Rep Power: 4
![]() |
I know, but if it's
variable = value Then wouldn't that be working from left to right? C assigns right to left
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
|
|
#12 |
|
Programming Guru
![]() ![]() ![]() |
the calculation of value must occur first
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#13 | ||
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Quote:
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
||
|
|
|
|
|
#14 |
|
Programming Guru
![]() |
hehe, and i think for most people who have programmed for a while
value = variable <---- is just wrong on so many levels variable = (value with possible workingout's) < much nicer i feel it is also easier to read as if you have a lot of calculations over multiple lines its easier to look at the start of a calculation to find the variable then at the end.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#15 | ||
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 550
Rep Power: 4
![]() |
Quote:
:blink: :blink:
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
||
|
|
|
|
|
#16 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
One more thing - if you use an array for the months, it'll make it so much easier:
int month; std::string months[12] = "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"; char mon[10]; mon = c_str(months[month]); |
|
|
|
|
|
#17 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Thanks guys, my following question:
If user enter 1 then this month represent January: How could I assign the variable mon to be equaled to January? if (month == 1) mon = "January"; But this wont work.. I don’t know why.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#18 |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 550
Rep Power: 4
![]() |
Use strcpy(mon, "January"); make sure mon is big enough to hold the word
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
|
|
#19 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Is that right: :unsure:
int date; int month; int year; double mon; cout << "Please Enter the date(EX: 1 or 2)" << endl; cin >> date; cout << "Please Enter the month(EX 1 or 2)" << endl; cin >> month; cout << "Pleae Enter the year(2004 or 2003)" << endl; cin >> year; if (month == 1) strcpy(mon, "January");
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#20 |
|
Programmer
Join Date: Oct 2004
Posts: 32
Rep Power: 0
![]() |
use Ooble's array to do it, it's much cleaner and easier. I agree with his method.
__________________
<CENTER><span style='font-size:17pt;line-height:100%'>My Homepage</span></CENTER> |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|