News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

plz check as CodeBlock syntex

Started by zu007, August 13, 2012, 03:58:47 PM

Previous topic - Next topic

zu007

plz check as CodeBlock syntex(this program written in turbo c 3.0 syntex)

#include<conio.h>
#include<string.h>
#include<iostream.h>
class String
{
private:
char str[40];

public:
      void menu()
      {
      gotoxy(30,12);
cout<<"Menu";
gotoxy(30,14);
cout<<"1.Comparing Strings";
gotoxy(30,16);
cout<<"2.Add to Strings";

      }
       void getdata()
{
    cin.getline(str,40);
}
int operator ==(String i)
{
if(strlen(str)==strlen(i.str))
       return 1;
       else
       return 0;
}

       void showdata()
       {
       cout<<str;
       }

String operator+(String ob)
      {
    String t;
    strcpy(t.str,str);
   strcat(t.str,ob.str);
    return(t);
      }
};
void main()
{
String a,b,c;
char ch;
clrscr();
a.menu();
ch=getch();
clrscr();
gotoxy(30,12);
cout<<"Enter first string";
a.getdata();
gotoxy(30,14);
cout<<"Enter second string ";
b.getdata();
clrscr();
switch(ch){
case'1':
       if(a==b)
       {
       gotoxy(30,14);
cout<<"string are equal";
}
else
{
gotoxy(30,14);
cout<<"string are not equal";
}
break;
case'2':
       c=a+b;
       c.showdata();
       break;

}
getch();
}

ollydbg

What is your problem? How can we help you?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Ceniza

My guess is that he's trying to compile something targeted for the old DOS era Turbo C/C++ compiler from Borland with a newer compiler from another vendor (most likely GCC). That will not work out of the box, and this is not the right place to ask for solutions (it has nothing to do with the IDE).

Jenna

@zu007:

Please do not post the same question twice in two sections !

I removed the other post.

Quote from: Ceniza on August 13, 2012, 05:18:57 PM
My guess is that he's trying to compile something targeted for the old DOS era Turbo C/C++ compiler from Borland with a newer compiler from another vendor (most likely GCC). That will not work out of the box, and this is not the right place to ask for solutions (it has nothing to do with the IDE).

Please read the answer carefully.
What Ceniza means, isthat this is not the right forum/website to ask.


When you registered here, you accepted our forum rules:

Quote from: MortenMacFly on January 24, 2009, 09:14:54 PM
[...]1. This is NOT a general programming board. "How do I write a program that....", "Can anybody teach me how to", "I have this homework", "My program doesn't run and I don't have the slightest idea of why because I'm a C++ newcomer", "What is a compiler", "What does gcc do" is the kind of questions that is FORBIDDEN to ask.

2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.

[...]

4. Search before you post. If you've used other IDEs and you're moving to Code::Blocks, try reading the Wiki (e.g. http://wiki.codeblocks.org/index.php?title=FAQ) at the homepage, and if you're confused on how to set up things, SEARCH THE FORUM. Probably the answer you're looking for is in there. Remember, Google is your friend :)

[...]

Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.

[...]

More general help how to use our forum you'll find here, too.

Please respect these rules !


Topic locked, because it violates our forum rules.