PDA

View Full Version : Could someone help me with C++ stuff??


silvia S13
09-28-2002, 10:39 PM
I am trying to do something like:


if (blahblah(a))
{
...
}

This is the function:

bool blahblah(a)
{
bool return (a=5);
}

but it's giving me undeclared identifier.
What's going on?
I have #include<iostream> and using namespace std; on top, do I need something else???

I am a freshmen in college, and just learning this, and have no clue how to do it. Someone please help. Thanks a lot.

fodive
09-29-2002, 01:04 AM
are you using bool blahaha as a global variable, cause i know in C that can give you oodles of trouble, but not sure about C++

silvia S13
09-29-2002, 08:34 AM
blahblah is a function. &nbsp;This is in C++

Titan
09-29-2002, 09:23 AM
Did you not define all those if statements in a main() function?

Kreator
09-29-2002, 02:40 PM
First of all, you are supposed to put the type when u declare the function:
e.g - blahblah(int a)

second, i think you wonna return (a==5), cuz (a=5) just assignes 5 to a and returns true. and u just do "return ..." instead of "bool return". the program alrdy knows it's bool when u declared the function.

Hope this helps

silvia S13
09-29-2002, 04:56 PM
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Kreator @ Sep. 29 2002,3:40)</td></tr><tr><td id="QUOTE">First of all, you are supposed to put the type when u declare the function:
e.g - blahblah(int a)

second, i think you wonna return (a==5), cuz (a=5) just assignes 5 to a and returns true. and u just do "return ..." instead of "bool return". the program alrdy knows it's bool when u declared the function.

Hope this helps</td></tr></table><span id='postcolor'>
Thanks a lot, I figured it out already, it was a mistake in the book about the "bool return", it's just return. &nbsp;Also, I forgot to declare.

aqwkmf
09-29-2002, 08:18 PM
i just started c++ this year too...im a senior in high school....i hope its not to hard

SimpleS14
09-29-2002, 09:39 PM
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (aqwkmf @ Sep. 28 2002,10:18)</td></tr><tr><td id="QUOTE">i just started c++ this year too...im a senior in high school....i hope its not to hard</td></tr></table><span id='postcolor'>
It not hard in high school, but wait tell you get to college.

I'm at CS 211 (or level 2) and its giving me some tough times. <img src="#/f/iB_html/non-cgi/emoticons/huh.gif" border="0" valign="absmiddle" alt=':huh:'>

Hey silvia S13 what college do you go to?

Kreator
09-29-2002, 09:41 PM
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (GT specR @ Sep. 29 2002,10:39)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (aqwkmf @ Sep. 28 2002,10:18)</td></tr><tr><td id="QUOTE">i just started c++ this year too...im a senior in high school....i hope its not to hard</td></tr></table><span id='postcolor'>
It not hard in high school, but wait tell you get to college.

I'm at CS 211 (or level 2) and its giving me some trobule. <img src="#/f/iB_html/non-cgi/emoticons/huh.gif" border="0" valign="absmiddle" alt=':huh:'></td></tr></table><span id='postcolor'>
Lol, wait till you get to level 4 <img src="#/f/iB_html/non-cgi/emoticons/smile.gif" border="0" valign="absmiddle" alt=':)'> that's when the real pita starts.

silvia S13
10-02-2002, 05:47 AM
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (GT specR @ Sep. 29 2002,10:39)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (aqwkmf @ Sep. 28 2002,10:18)</td></tr><tr><td id="QUOTE">i just started c++ this year too...im a senior in high school....i hope its not to hard</td></tr></table><span id='postcolor'>
It not hard in high school, but wait tell you get to college.

I'm at CS 211 (or level 2) and its giving me some tough times. <img src="#/f/iB_html/non-cgi/emoticons/huh.gif" border="0" valign="absmiddle" alt=':huh:'>

Hey silvia S13 what college do you go to?</td></tr></table><span id='postcolor'>
I am at Stevens Insititute of Technology, it's hard as hell. &nbsp;I regret coming here. &nbsp;It's a geek school. &nbsp;What bout you guys? &nbsp;Comp Sci is my major, but the classes have been easy so far, except that they don't teach and just tell you to read, and when there's a mistake in the book, it completely fucks me over like this time.

Kreator
10-02-2002, 10:11 AM
University of Maryland College Park <- one of the top 10 comp sci schools <img src="#/f/iB_html/non-cgi/emoticons/smile.gif" border="0" valign="absmiddle" alt=':)'>