Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-2008, 01:35 PM
Dren's Avatar   
Dren Dren is offline
Guru
 
Join Date: Nov 2006
Location: Kosovo
Age: 18
Posts: 421
Rep Power: 13
Dren is just really niceDren is just really niceDren is just really niceDren is just really nice
Send a message via MSN to Dren
Default Visual Basic to C++ Syntax Translation

Hello,

I’m sorry for being off all the time (for nearly 2 years I guess) but I promise I won’t be again. When I was here for the first time I met TcM, he helped me translate something using a HEX-Editor and suggested me to start programming on Visual Basic 6 and I did so. For about 2 years I have been coding on VB6 and now I’m trying to start coding on C++. It doesn’t seem to be much hard because I have some C++ books but I can’t find some functions that I use on VB6 so I came back here to ask.

So, could anyone please tell me these functions on C++?

The VB6 functions:
Len()
Rigt()
Left()
Mid()
Chr() “or should I write my own?

Seems I have problems only with string functions. I don’t even know how to set a String Variable, only Char. As I read in one of my books C++ doesn’t support string variables longer than 1 characters so I have to use Arrays(wich I don’t know how in C++), I hope that’s not true.

Today I wrote a program for converting Base10 numbers to Base16 but I couldn’t print the output backwards.

The last question, do you suggest me C++ or Visual C++. I code only for Microsoft OS-es.

Thanks a lot,
Dren
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-21-2008, 02:06 PM
marwex89's Avatar   
marwex89 marwex89 is online now
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,992
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Talking Re: Visual Basic to C++ Syntax Translation

Include <cstring> and take a look at the high-level functions there.

Code:
string s1, s2; // Empty strings
string s3 = "Yo dude"; // Initialized
string s4("I am cool"); // Also initialized
s2 = "C++ sucks"; // Assigning to a string
s1 = s3 + " " + s4; // Combining strings
s1 += "8"; // Appending to a string
"There are libraries for everything!" (C++ librarian)
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-21-2008, 02:36 PM
Dren's Avatar   
Dren Dren is offline
Guru
 
Join Date: Nov 2006
Location: Kosovo
Age: 18
Posts: 421
Rep Power: 13
Dren is just really niceDren is just really niceDren is just really niceDren is just really nice
Send a message via MSN to Dren
Default Re: Visual Basic to C++ Syntax Translation

Quote:
Originally Posted by marwex89 View Post
Include <cstring> and take a look at the high-level functions there.

Code:
string s1, s2; // Empty strings
string s3 = "Yo dude"; // Initialized
string s4("I am cool"); // Also initialized
s2 = "C++ sucks"; // Assigning to a string
s1 = s3 + " " + s4; // Combining strings
s1 += "8"; // Appending to a string
"There are libraries for everything!" (C++ librarian)
WoooooW, THANK U MAN, THANK U SO MUCH, that is relly GREAT. I Googled cstring C++ library and got all the functions I needed except Chr().

About the last questin, what do you suggest? Visual C++ or C++?

Thanks A TON
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-21-2008, 02:55 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 77
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Visual Basic to C++ Syntax Translation

What do you mean Visual C++ or C++?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-21-2008, 06:00 PM
marwex89's Avatar   
marwex89 marwex89 is online now
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,992
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Visual Basic to C++ Syntax Translation

Visual C++ = Microsoft Visual Studio (not 2008, that is MANAGED C++, but earlier) C++

C++ means usually GNU free compiler, like MingW.

I use the last one, but many people use the Express edition of VS. Try both, it's free
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 07-21-2008, 06:04 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 77
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Visual Basic to C++ Syntax Translation

Oh okay? Lol, I kind of thought that, but wasn't really sure what someone would want to know about them.

Personally I use Dev-Cpp and Code::Blocks, which use Gcc/MingW.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-21-2008, 06:17 PM
marwex89's Avatar   
marwex89 marwex89 is online now
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,992
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Visual Basic to C++ Syntax Translation

About char().... In C++ that's just a cast from an integer to char (32bit and 8bit), which can be done like this:

Code:
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char * argv[])
{
    int ASCII = 65;
   // int ASCII = 0x41; // In hexadecimal, if you need it
    char c1 = static_cast<char>( ASCII ); // Declare c1 as char, and perform cast
    cout << c1 << endl; // Display character (Uppercase A)
    system("PAUSE");
    return (EXIT_SUCCESS);
}
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-21-2008, 09:03 PM
Dren's Avatar   
Dren Dren is offline
Guru
 
Join Date: Nov 2006
Location: Kosovo
Age: 18
Posts: 421
Rep Power: 13
Dren is just really niceDren is just really niceDren is just really niceDren is just really nice
Send a message via MSN to Dren
Default Re: Visual Basic to C++ Syntax Translation

GOD **** IT I need study these **** libraries first That is GREAT Bro, I REALLY APPRECIATE YOUR HELP

About the C++ or VC++ that was what I was thinking of. So U suggest me C++? I dont have that but can I use the VC++ 6 ConsoleApplication method instead?

Will it be easier for me to get from C++ coding to VC++ creating forms and linking their objects to the code or am I wrong? I really need some suggestions, yesterday I started this and Im NOT going to give up.

THANX AGAIN marwex89, U R MY BRO
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-21-2008, 09:17 PM
marwex89's Avatar   
marwex89 marwex89 is online now
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,992
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Visual Basic to C++ Syntax Translation

No problem
VC++ and C++ is just the same... It doesn't really matter to most people, I guess it would take you about a week to get into VC++ IDE (wild guess) and their linking and form creating.

There is no form creating in C++ (Dev-C++, NetBeans etc), so unless you want to hard code your forms, I suggest you at least try Visual Studio to see if that's OK.

Warning: Pro edition = $$$, use Express

Using VC++ console app:
That's a template, with compiler and linking options set etc. All common C++ IDEs have those.

Any more I could help you with while we're at it?

EDIT:
BTW, you have VisualStudio 6???
Use it. Period
See a comparison on web between C++ in VS6 and newer. If nothing you absolutely MUST have, use VS6, I guess.
__________________

Last edited by marwex89; 07-21-2008 at 09:20 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-21-2008, 11:04 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 787
Last Blog:
Programs Under the Hoo...
Rep Power: 13
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: Visual Basic to C++ Syntax Translation

Len() has several equivalents in C++.

1) For structures and primitives like int, etc., use sizeof().
2) For strings, use strlen() for primitive strings, i.e. char arrays. (include string.h)
3) I don't know how to get the length of a string string.
4) For dynamically allocated memory, use _msize() (include memory.h or malloc.h)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Contest: C# vs. Java vs. Visual Basic Jordan General Programming 265 11-27-2008 08:26 PM
Creating a Class in Visual Studios.Net (Visual Basic Section) dream Visual Basic Programming 11 05-12-2008 03:47 PM
Visual Studio 2005 and Windows Vista Jordan General Programming 3 01-22-2007 04:21 PM
Graphical programming add-in for Visual Basic 6.0 xXHalfSliceXx Visual Basic Programming 10 01-03-2007 08:14 AM
Parallel Port Programming Using Visual Basic kevintcp85 Visual Basic Programming 12 12-06-2006 01:09 PM


All times are GMT -5. The time now is 02:15 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%

Ads