c++ Interview Questions and Answers


 

Interview Question in c++

How can you make c++ program end itself

Whenever a c++ program that I make ends, no matter whether it is by using "return" or "exit(0)", it always displays, "Press any key to continue" before the window closes itself. Is there a way to get rid of this message and have the window close itself without having to press a key?
I am just learning c++ and I haven't been able to find the answer to this question anywhere else. I've got Microsoft Visual Studio.net 2003.
Thanks

C++/MFC compilation error, help (c++ newbie)

hi, i'm trying to learn using MFC and the first example i tried out didn't compile on visual c++ 2005. here it is:
i created a win32 empty project and added one source file with the following:

---

#include <afxwin.h>


class CMyApp : CWinApp
{
public:
virtual BOOL InitInstance();
};

class CMyWindow : CFrameWnd
{
public:
CMyWindow()
{
Create(0, L"My first app, ehi2");
}
};


BOOL CMyApp::InitInstance()
{
m_pMainWindow = new CMyWindow;

m_pMainWindow->ShowWindow(m_nCmdShow)...
return TRUE;
}

CMyApp App;

-------

when i compile it says:
"Error 1 fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d] c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h 24 "

what should i do?

How i can issue command line (e.g running ms-dos program) in C++ programmig environment

i want to execute ms-dos program in c++ code. how?
(i uses Visual studio 2005 - VC++)

Golf game using c++

I need help in writing a golf game using c++ on Visual Studio - 2005. Could anyone just give ideas how to do it? The program should allow the user to play one hole a 280 metre par 5.
Please help......

Windows Form Application help please

I have created a windows form application project in visual studio 2005 that consists of many forms.In one of the forms I need to have access to what has been written in a previous form by the user.how can I do so?(using c++)
Thanks a lot

A question about c++ and opengl

I have learned c++ basics but i think i need to know what is a buffer so:
1.I need someone to explain to me what a buffer is and when we use it.
2.I want to start using opengl but i know nothing about it..... I use visual studio 2005 .... Is there anything i need to download before i start using opengl through visual studio?.... I need to
know how to open a new project and how to add the the libraries i need....
Is it a an advanced level to start making programs that have simple graphics... you know, like using buttons instead of writing commands and so on?
After you help me with the previous things, can you recommend a good tutorial to help me understand opengl... if not, is there a book instead of a tutorial?

NOTE: I use visual studio not visual basic.... Online tutorials helps you create opengl projects in visual basic!!
THANKS IN ADVANCE!!!

Can any 1 help me to write c++ program

i dont no what i have to do and where to write program in visual studio 2005. 1 more thing is i cant find win 32 in ma school pc. my assignment is

programming asssignment 1
csc121-0AC
computer science I
author : supritkumar
due date : Tuesday ,Sept 23

all this things in rectangle box made of ****** stars

While creating an adobe indesign plug-in,how to add reference to a 3rd party dll in c++

I need to create a connection between Adobe indesign (layout design tool) and Mark logic server.

For that i have to create a plugin for indesign which establishes connection with marklogic.

As a test project, i was successful in creating a sample web form application that connects to marklogic and fetches data from it.There i was getting directly an option to browse for marklogic dll under "add reference".

To create a plgin,a tool has been given by Indesign sdk,called dollyXs which generates basic vc++ code (vc++ project in visual studio 2005) for developing plugins.

In this VC++ project of visual studio, when i tried to add a reference to marklogic dll, im not getting any option under "add reference" for browsing that dll and adding it to the vc++ project.

Kindly help me and thnx in advance.

please mail me at sunil_chengalva@satyam.com.

Regards,
sunny.

Is it possible to use two cpp files at a time

I am a c++ beginner ... I would like to know if there is a way to make a program like this: At the beginning, there is a condition which if true , a cpp file is opened.... if not another cpp file is opened (having a totally different main and different function....... note: i use visual studio 2005!!

Visual c++ heeelllllllllpppppppp please

I'm new in visual c++ and i cant make the hello world project cuz i cant play it i dont know what kind of a app should i use and if i press the play button it tells me

unable to start program 'c:\document and settings\username\my documents visual studio 2005\projects\hkgk\debug\hkgk.exe'

the system cannot fide the specified


so please any one help i have been trying for 3 days and nothing it's driveing me crazy

Question about visual C++

Here is the code:
// my first program in C++

#include <iostream>
#include <cstdlib>
#include "stdafx.h"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
cout << "Hello World!";
return 0;

}


the error:
1>Compiling...
1>std.cpp
1>c:\users\hong wei\documents\visual studio 2005\projects\ok\ok\std.cpp(6) : error C2871: 'std' : a namespace with this name does not exist
1>c:\users\hong wei\documents\visual studio 2005\projects\ok\ok\std.cpp(10) : error C2065: 'cout' : undeclared identifier
1>Build log was saved at "file://c:\Users\Hong Wei\Documents\Visual Studio 2005\Projects\ok\ok\Debug\BuildLog.htm"
1>ok - 2 error(s), 0 warning(s)

so how to fix it i am using visual c++ express

Why rand() doesn;t work in visual studio

I am using visual studio 2005 for c++ programming.... I tried to use rand() function to generate a random number in a win32 console application but i recieve an error that says identifier ( rand ) not found!!!
That means that it doesn't even exist.... What is the problem??

I remember also that when i try to copy source codes from a website, some libraries return an error saying that they are not found such as iostream.h.... and functions such as cout (although i don't know what it means yet!!!

Thanks in advance......... :):):):)

Visual studio c++ 2005 free download

Hi. can someone tell me where i can get that (title) for free i tried microsoft...it doesnt work it only downloads express edition..i just want normal one.. Thanks.

Microsoft Visual Studio 2005 c++

In this where exactly shall i click to start a C programe with source only for example a hello world programe ?

I make programs in c++ on turbo c++ compiler , the same programs don;t run in visual studio 2005

What should i do?I am not able to run the simplest of all programs that is to print hello world , please help me

Why when i compile my c++ project with visual studio 2005

the error message tell me tat cannot find <iostream.h>....dunno why....can anyone tell me??

C++ help ...Visual studio 2005..what causes the error

i just wrote this in visual studio c++:
please let me know what causes the error:
int main()

{
int distance=0;
int rate_miles=0;
int elapsed_time=0;
cout<<"Enter the rate in miles";
cin>>rate_miles;
cout<<"Enter the elapsed time";
cin>>elapsed_time;
distance= rate_miles* elapsed_time;
cout<<"total distance is:">>;
cout<<distance;
}

Vc++ migration issues from Visual Studio 2003 to 2005

Would like to have the details about 1) Architectural issues 2) compilation issues 3) linker issues 4) dll issues 5) com issues 6) other issues 7) how to rectify these issues of VC++ source codes ,while migrating from visual studio 2003 to visual studio 2005
123