| | |
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!
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets







