Qbasicnews.com

Full Version: C++ translator in QB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Make a C++ translator like QB, using QB(not FB, FB sucks).

Just think, if you accomplish this, people will think your'e cool :lol: .

Good luck, cause you'll need it badly Smile .
Well, FB or QB shouldn't matter since FB can compiler for DOS, just like QB can ;-). Cept you have the handycap of never having to worry about RAM ever again in FB for DOS...(I for one can live with that).

But a challenge is a challenge, you can ask it done in QB but there's no need to bring down FB in the process ;-).
What exactly would a "C++ translator" do? Translate it into English? Wink

But seriously - what do you mean? A C++ interpreter? or perhaps compiler?
yeah, c++ has pointers, fb has pointers, qb doesn't have pointers...
Do you mean you put c++ in, and it translates it so you get basic code out?
no it should translate it to cookies, nice warm brown cookies.

come on you have no idea what you are talking about :p
Code:
/*
* my AWESOME C++ translator program
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char**argv)
{
  char buf[128];
  printf("Enter a line of text:\n");
  fgets(buf, sizeof(buf), stdin);
  // this is where it translates:
  sprintf(buf, "you are uncool");
  printf("The translated text is:\n");
  printf("%s\n", buf);
  return 0;
}
[syntax="C++"]// My lovely C++ translator program

#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

int main (int argc, char** argv)
{
string userStr, newStr = "";
cout << "Enter some text: " << endl;
getline(cin, userStr);
userStr = "099 111 111 107 105 101 115 044 032 110 105 099 101 032 119 097 114 109 032 098 114 111 119 110 032 099 111 111 107 105 101 115";
cout << "The translated text is:" << endl;
for (int i = 0; i < userStr.length(); i+=4)
newStr += (char)atoi((userStr.substr(i, 3)).c_str());
userStr = newStr;
cout << userStr << endl;
system("pause");
return 0;
}[/syntax]
Quote:What exactly would a "C++ translator" do? Translate it into English? Wink

But seriously - what do you mean? A C++ interpreter? or perhaps compiler?

The word translator in the programming world means like a compiler minus the compiling. In other words, like QB.

Hope this clarifies things Smile ...
Quote:But a challenge is a challenge, you can ask it done in QB but there's no need to bring down FB in the process ;-).


I'm sorry. I just got mad at it because I accidently deleted my copy and had to work off of QB4.5 until I could find a new copy.

No hard feelings, right Smile ?
Quote:yeah, c++ has pointers, fb has pointers, qb doesn't have pointers...
Do you mean you put c++ in, and it translates it so you get basic code out?

Moreover C++ is object oriented while QBasic isn't.
Pages: 1 2