| | |
Need Help with evaluation
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 48
Reputation:
Solved Threads: 0
Hello.,
I'm very new in C++, and I have a task to solve.
I have a function:
here iss what i have done:
The problem id the function cio_putstr() returns void, thats why lazy evaluation is not possible. Any other thoughts would be greatly appreciated!
Thank you
I'm very new in C++, and I have a task to solve.
I have a function:
C++ Syntax (Toggle Plain Text)
void cio_display(const char *str, int row, int col, int len){ int i; cio_move(row, col); if(len<=0) { cio_putstr(str); } else{ for(i=0;i<len && str[i];i++) cio_putch(str[i]); for(;i<len;i++) cio_putch(' '); }
here iss what i have done:
C++ Syntax (Toggle Plain Text)
void cio_display(const char *str, int row, int col, int len){ int i; cio_move(row, col); for( i = 0; ((len <= 0) && cio_putstr(str)), (i < len && str[i]); i++){ cio_putch(str[i]); } for(;i<len;i++) cio_putch(' '); }
The problem id the function cio_putstr() returns void, thats why lazy evaluation is not possible. Any other thoughts would be greatly appreciated!
Thank you
What's a problem?
C++ Syntax (Toggle Plain Text)
for (i = 0; len <= 0 && str[i] || str[i] && i < len; i++) { cio_putch(str[i]); } while (i++ < len) cio_putch(' ');
> To the OP: You say that this function -
> To Ancient Dragon: I read about "lazy evaluation" in some book, but I don't remember which one
... Anyway, here is wiki on it.
cio_putstr() returns a void . If this is so, then just why is it in your for loop as a test expression? And could you explain what it - cio_putstr() - is supposed to do?> To Ancient Dragon: I read about "lazy evaluation" in some book, but I don't remember which one
... Anyway, here is wiki on it. Last edited by amrith92; May 24th, 2009 at 6:37 am.
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
•
•
•
•
Originally Posted by amrith92;874959[B
>[/B] To Ancient Dragon: I read about "lazy evaluation" in some book, but I don't remember which one... Anyway, here is wiki on it.
OMG I've been doing that for 50 years and always thought it was called procrastination. Now I know I was just plain lazy
![]() |
Similar Threads
- postfix expression evaluation (C++)
- how to make an evaluation version? (Visual Basic 4 / 5 / 6)
- Connect 4 Evaluation functions (Java)
- Server 2003 evaluation copy (Windows NT / 2000 / XP)
- evaluation of stacks (C)
Other Threads in the C++ Forum
- Previous Thread: Problem writing to a binary file
- Next Thread: need help to solve this problem!
Views: 329 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory multidimensional newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







