Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog or “dynamic” Menu? Pin
pasztorpisti24-Mar-13 4:53
pasztorpisti24-Mar-13 4:53 
QuestionProblem with flockfile and funlockfile Pin
noislude23-Mar-13 4:09
noislude23-Mar-13 4:09 
Question(ask) need help how to divide a file into some file Pin
moonstalker23-Mar-13 3:49
moonstalker23-Mar-13 3:49 
AnswerRe: (ask) need help how to divide a file into some file Pin
dusty_dex23-Mar-13 4:36
dusty_dex23-Mar-13 4:36 
GeneralRe: (ask) need help how to divide a file into some file Pin
moonstalker23-Mar-13 8:53
moonstalker23-Mar-13 8:53 
AnswerRe: (ask) need help how to divide a file into some file Pin
ramrooney26-Mar-13 7:39
ramrooney26-Mar-13 7:39 
SuggestionRe: (ask) need help how to divide a file into some file Pin
Shaheed Legion27-Mar-13 0:48
Shaheed Legion27-Mar-13 0:48 
QuestionHelp needed to print the value nth number raised to the power n. Pin
Rajdeep_22-Mar-13 21:46
Rajdeep_22-Mar-13 21:46 
Hello People,

I am quite a newbie to C++ programming and I got stuck up with a simple program. The program requires me to print the value for 2 raised to the power 20. I actually had the idea creeping about this program since 1 megabyte is 2 raised to the power 20. I wanted to find the result of that via this piece of code:

C++
#include<iostream.h>
#include<conio.h>
int main()
{
int a=2;
for (int i=2; i<=20; i++)
{
a=a*a;
}
cout<<a;
getch();
return 0;
}


and the output I get is: 0

The compiler/IDE I'm using is Borland C++ (latest version) but I know theres nothing wrong with the compiler though. There must be some logical mistake. Rectification would be appreciated folks. Hoping for help.

Thanks!
Rajdeep_

modified 23-Mar-13 3:55am.

AnswerRe: Help needed to print the value nth number raised to the power n. Pin
Richard MacCutchan22-Mar-13 23:47
mveRichard MacCutchan22-Mar-13 23:47 
GeneralRe: Help needed to print the value nth number raised to the power n. Pin
Rajdeep_23-Mar-13 0:08
Rajdeep_23-Mar-13 0:08 
AnswerRe: Help needed to print the value nth number raised to the power n. Pin
V.J.NAGA VARA PRASAD23-Mar-13 4:36
V.J.NAGA VARA PRASAD23-Mar-13 4:36 
AnswerRe: Help needed to print the value nth number raised to the power n. Pin
Vaclav_23-Mar-13 4:52
Vaclav_23-Mar-13 4:52 
GeneralRe: Help needed to print the value nth number raised to the power n. Pin
Richard MacCutchan23-Mar-13 6:00
mveRichard MacCutchan23-Mar-13 6:00 
SuggestionRe: Help needed to print the value nth number raised to the power n. Pin
David Crow23-Mar-13 16:05
David Crow23-Mar-13 16:05 
QuestionDirectX SDK – which version? Pin
Vaclav_22-Mar-13 8:38
Vaclav_22-Mar-13 8:38 
AnswerRe: DirectX SDK – which version? Pin
dusty_dex22-Mar-13 8:45
dusty_dex22-Mar-13 8:45 
QuestionUse InternetSetOption() to change proxy Pin
Oren_Davod21-Mar-13 23:03
Oren_Davod21-Mar-13 23:03 
AnswerRe: Use InternetSetOption() to change proxy Pin
Richard MacCutchan21-Mar-13 23:38
mveRichard MacCutchan21-Mar-13 23:38 
Generalc++ queue OUTPUT ? Pin
kr kumar21-Mar-13 9:33
kr kumar21-Mar-13 9:33 
GeneralRe: c++ queue OUTPUT ? Pin
jeron121-Mar-13 10:18
jeron121-Mar-13 10:18 
QuestionRe: c++ queue OUTPUT ? Pin
David Crow21-Mar-13 17:08
David Crow21-Mar-13 17:08 
QuestionChoosing which information that Windows Vista's folder contents displayer is to display Pin
Anthony Appleyard21-Mar-13 3:41
Anthony Appleyard21-Mar-13 3:41 
AnswerRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
David Crow21-Mar-13 4:44
David Crow21-Mar-13 4:44 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
Anthony Appleyard21-Mar-13 5:16
Anthony Appleyard21-Mar-13 5:16 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
David Crow21-Mar-13 5:26
David Crow21-Mar-13 5:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.