|
-
Feb 10th, 2003, 08:59 PM
#1
Thread Starter
Junior Member
Implement MID function
I need implement a MID function like this:
Mid(string,START,FINISH)
Thanks
-
Feb 11th, 2003, 06:14 AM
#2
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 11th, 2003, 07:12 AM
#3
Frenzied Member
General idea:
Code:
char *mid( char *strDest, const char *strSrc,
size_t count,size_t offset ){
strncpy(strDest, *(strSrc+offset), count);
return strDest;
}
-
Feb 11th, 2003, 08:03 AM
#4
transcendental analytic
I think the extra abstraction layer is unnessesary overhead
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 11th, 2003, 02:00 PM
#5
Frenzied Member
It is.
But he asked how to do it. So I did it. He's a VB programmer trying to learn C, obviously.
-
Feb 11th, 2003, 05:43 PM
#6
transcendental analytic
yeah obviously, but i think we'd do him a favour suggest to learn the language instead.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 12th, 2003, 03:40 PM
#7
Thread Starter
Junior Member
Thanks for the example.
Yes, i am a Vb programmer, i try learn VC, is very versatile, but very hard to learn too.
-
Feb 12th, 2003, 07:35 PM
#8
Important lesson: VC and VC++ are not languages. VC++ is an IDE. C and C++ are languages.
As for mid: it's called substr in the string class.
Code:
#include <string>
#include <iostream>
using namespace std;
int main()
{
string mystring("Hello, there!");
cout << mystring.substr(3, 4) << endl;
return 0;
}
Output:
lo,
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|