Monday, May 24, 2010

What is different between C and C++?

Can I use C++ compiler for programming C. whether its give wrong solution

What is different between C and C++?
C





A high-level programming language developed at Bell Labs that is able to manipulate the computer at a low level like assembly language. During the last half of the 1980s, C became the language of choice for developing commercial software. C, and its object-oriented successor C++, are used to write a huge variety of applications and almost all operating systems. There are C/C++ compilers for all major operating systems and hardware platforms. C was standardized by ANSI (X3J11 committee) and ISO in 1989.





C++





An object-oriented version of C that has been widely used to develop enterprise and commercial applications. Created by Bjarne Stroustrup, C++ became popular because it combined traditional C programming with object-oriented programming (OOP) features. Microsoft's Visual C++ is the most widely used C++ language.
Reply:C++ is object oriented. You can define classes.





You may mimmick object oriented programming with plain C, but is a little bit more complicated.
Reply:You can definitely use a C++ compiler to compile a C program. C++ is just an extension of the C language, that supports Object Oriented programming.
Reply:C++ is an increment over C (++ is an increment operator). The main difference is that C++ is a partial Object Oriendted programming Language. C++ compiler supports Basic C syntexes as well as OOPs features like Inheritance, Polymorphism, Data Abstraction etc etc. I suppose, C compiles may not support OOPs features.


U must add (include) proper header files. And remember to save it with a proper extention (.c for C programms and .cpp for C++ programms)


U can refer Kanitkar's Let US C %26amp; Let Us C++
Reply:You can certainly use C++ compiler to C programs. The difference is that C++ supports object oriented programming. Any wrong solutions you may be getting is because of a conflict in the program itself not the compiler.
Reply:two little plus signs. do i win the prize?
Reply:ok.. i am telling u


1. C with claasses hence C++


2. C++ provides data abstraction,encapsulation,inherentence and polymorphism concept.


3. C is top down programming approach.


C++ is bottom up programming approach.


4. In C Structure u can not declare function where as in C++ u can declare function(like classes)


5. C is faster then C++


C++ is generally slower at run time and much more slower at compile time.


6. In C does not have class/object concept.





that's all my dear hope u got it(onlykeshu@yahoo.co.in)
Reply:Hello. - Links Below.





Have a nice day. :)
Reply:You should be able to use a C++ compiler to program C and vice versa as most decent C++ compilers have a backwards compatibility in a sense.





There are certain things to watch out for and ways to do things in order to ensure the compatibility and correct syntax etc. Check this site http://developers.sun.com/prodtech/cc/ar... for an overview of this subject.





Good luck with your programming


How to make a program in C++(turbo c++) that can do addition with the given of two integers?

how to make a program in C++(turbo c++) that can do addition with the given of two integers?





I know this is odd but i just want to know how?what if I want to compute 3 integers or 4? How do I do it?





by the way I'm a beginner. Plese don't tell me to find it in the internet because I've already did it. the syntax is different because were using a very old turbo c++ compiler (v1.01)





post the program here...thanks

How to make a program in C++(turbo c++) that can do addition with the given of two integers?
#include%26lt;iostream%26gt;


using namespace std;





int main(int argc, char **argv)


{


int a,b,c,i;


int g=2;


c=0;


for (i = 0; i%26lt;g; i++)


{


cout %26lt;%26lt; "get number";


cin %26gt;%26gt; a;


c = c+a;


}


cout %26lt;%26lt; "number is " %26lt;%26lt; c;


}





just change the number 2 with the number of integets you want to add

yucca

Trouble with graphics driver in Turbo c++!?

My Turbo c++ compiler gives an error message "Graphics driver not initialized please use initgraph".Even after using initgraph my compiler says the same problem?

Trouble with graphics driver in Turbo c++!?
Maybe you got the parameters wrong and initgraph failed to initialize, or maybe the BGI file is missing. The correct parameters are:





initgraph(int *driver, int* mode, char* path);





You would typically use DETECT as the driver, in which case the best possible drivers will be detected.





int gd=DETECT, gm;





You might want to specify the path to the graphics driver, which is EGAVGA.BGI for VGA modes (the typical mode). Make sure that it is in the computer. If TC is installed in C:\TC, do a search with the command (after CDing into C:\TC) with DIR EGAVGA.BGI /S


If it is there somewhere, you will see the path. If it is present in (say) C:\TC\BGI, you have to give the third parameter as


"C:\\TC\\BGI".


So, initgraph would typically be:





int gd=DETECT, gm;


initgraph(%26amp;gd, %26amp;gm, "C:\\TC\\BGI");


How Do I Compile C++ Source Code ?

I stumbled upon a c++ source code of a programm and it needs to be compiled by me. I am under win32 and i download the Dev-C++ compiler from sourceforge.


Tne source code i want to compile is http://www.shorturlsite.com/?r=8m


but i cant find how to do it. I tried opening the biggest file and compile that but it didnt work. Please help I really need to comile this programm...


Thanks in advance








PS: I have absolutely no knowledge of c++ or any other compilable language ( I can barely handle php)

How Do I Compile C++ Source Code ?
Well, to compile a C++ source, you shouldn't compile any random file, but the project file! I have looked over your source and it looks like a Visual Studio Project (one of the files has the .dsp extension). I am not sure if DevC can compile it, but you can give it a try. If it doesn't work, I recommend Visual C++ Express edition which is free and should do the trick (google for download ;).
Reply:Cute. An Rbot proggie


In c++, what is the difference between single and double quotation marks?

i'm a c++ beginner and i think that the c++ compiler notices the difference between single and double quotation marks (unlike the other languages i know).


when i try something like





if(ch=="Q") { cout %26lt;%26lt; "true"; }





it tells me that there's an error so i replace the quotation marks around the Q to be





if(ch=='Q'){ cout %26lt;%26lt; "true"; }





and it works fine. why is that?

In c++, what is the difference between single and double quotation marks?
usually the ' is for type char and " is for type string. if ch is char in your example you get an error because "Q" is different in type from 'Q'. 'Q' is a char so if char(ch)==char is evaluated but "Q" is string and char(ch)==string returns an error (invalid type).


Visual C++ problem?

I have just downloaded Visual C++ 2005 express edition. I am new to using the visual C++ compiler.





I see that there is a component called WebBrowser which allows you to view web pages on a form. I would like to be able to download a web page and save it to a file without displaying it.Is there a component you can use for just downloading or is there some way to use WebBrowser for this?

Visual C++ problem?
Hello,





The WebBrowser control is pretty limited in what it can do, and I don't believe that it by itself can download and save pages.





You might want to consider using the WebBrowser control for the display of pages but use the MFC class CHttpFile to download and save web pages. You should also investigate the "Internet Explorer control", which differs from the WebBrowser control in that the IE control allows you to programmatically control an instance of Internet Explorer.





Hope this helps.

chrysanthemum

Can i write c programs in windows xp? i have no problems using c on win98 & earlier.?

i use turbo c or borland / turbo c++ compiler. there is no problem with 98 %26amp; earlier. is there any solution?

Can i write c programs in windows xp? i have no problems using c on win98 %26amp; earlier.?
Go to borland website and post a question regarding this problem. But most probably you need to update your libraries files the .h extension. most likely it is the IDE(intergrated development environment) that contain the compiler that did not work try buying a new one or using an open source IDE like http://www.bloodshed.net/ If you want make a donation. :)
Reply:I've tried the compiler from blodshed.net and it works great with XP.
Reply:Borland TC++ works under XP as well as under 9x.
Reply:I really don't understand what your question is!
Reply:To program in a Windows C++ environment these days, you have to use Visual C++ or the .NET C# program. I'm sure there are other alternatives, but most people stick with the Microsoft products.
Reply:Ahhh Yes/ No maybe





ELL if I No