Plz help me tell me how we can convert the C program in C++ I working on OCX(Active X controls) plzzzzzzzzzzz...............reply

C++ is a superset of C so any C program can be compiled and run as a C++ program(doesn't change the fact that it is really C)

>C++ is a superset of C
Not really. A is only a superset of B if A contains everything in B (and optionally more). This isn't the case with C and C++, especially considering the evolutionary path of C since C++ was created. Rather, C++ is based on C, and not all C code will compile or run the same as C++.

>any C program can be compiled and run as a C++ program
BS. Here's a perfectly correct C program that 1) fails to compile as is in C++, and 2) is subtly broken in C++ if you fix the compilation error:

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

int main ( void )
{
  int *p = malloc ( 10 * sizeof 'I' );
  int i;

  for ( i = 0; i < 10; i++ )
    p[i] = i;

  for ( i = 0; i < 10; i++ )
    printf ( "%d\n", p[i] );

  return 0;
}

Once again I say that converting C to C++ is harder than most people think, and unless the C code was written with C++ compatibility in mind, it's wise to be fluent in the differences between C and the C subset of C++.

To quote Salem, it's a semantic, not syntactic, superset

>To quote Salem, it's a semantic, not syntactic, superset
Then don't mix up the two. Saying, and I quote, "any C program can be compiled and run as a C++ program" refers to syntactic compatibility. Claiming you really meant that C++ is a semantic superset contradicts your previous statements. In fact, C++ being a semantic superset is quite irrelevant to the original question, which is how to modify C code so that it compiles and runs correctly as C++, not how to compare the two languages in a debate among pedants.

Personally, I see "Well, C++ is a semantic superset, which is still a superset" as nothing more than a backpedaling trick for people to claim they aren't wrong when they make erroneous claims about C and C++ compatibility.

scanf("%s",B.Writer);

Practice the bitwise-LeftShift (<<) and bitwise-RightShift (>>) for the following values.
Num1=90;
Num2=45;
Num3=20;
Num4=80;
Num5=90;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.