Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Where to set program name / version / copyright information in Visual Studio Pin
«_Superman_»17-Nov-09 12:58
professional«_Superman_»17-Nov-09 12:58 
AnswerRe: Where to set program name / version / copyright information in Visual Studio Pin
CPallini17-Nov-09 13:01
mveCPallini17-Nov-09 13:01 
GeneralRe: Where to set program name / version / copyright information in Visual Studio Pin
hongheo7618-Nov-09 16:39
hongheo7618-Nov-09 16:39 
QuestionMFC CSocketFile Pin
goutom roy17-Nov-09 10:39
goutom roy17-Nov-09 10:39 
QuestionRe: MFC CSocketFile Pin
CPallini17-Nov-09 11:43
mveCPallini17-Nov-09 11:43 
Questionstack and atoi Pin
khomeyni17-Nov-09 9:23
khomeyni17-Nov-09 9:23 
AnswerRe: stack and atoi Pin
«_Superman_»17-Nov-09 9:37
professional«_Superman_»17-Nov-09 9:37 
AnswerRe: stack and atoi Pin
CPallini17-Nov-09 11:41
mveCPallini17-Nov-09 11:41 
khomeyni wrote:
int n;
cout<<"please enter the size of string and then the string:"<<endl;
cin>>n;//for example 3
char *str=new char[n];
cin>>str;//for example 12

This is fragile (what if the user inserts a longer string?).


khomeyni wrote:
int compute(char* str){
stack <char> stck;
stck.push(*str);
stck.push(*(str+1));
while(!stck.empty()){
int first=atoi(&stck.top());
cout<<"this is first:"<<first<<endl;
stck.pop();
int sec="atoi(&stck.top());" why="" this="" cause="" error="" and="" return="" 12="" intead="" of="" 1??????????
stck.pop();
cout<<"this="" is="" sec:"<<sec<<endl;
}
return="" 0;
}<="" blockquote="">

This is a mess.
The function is confident that <code>(str+1)</code> is a valid address. That may be not true.
If you need to convert each single character into an integer then don't use <code>atoi</code>.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: stack and atoi Pin
khomeyni18-Nov-09 0:37
khomeyni18-Nov-09 0:37 
AnswerRe: stack and atoi Pin
David Crow18-Nov-09 3:44
David Crow18-Nov-09 3:44 
QuestionAcroPDF Refresh issue Pin
kasi1417-Nov-09 8:36
kasi1417-Nov-09 8:36 
QuestionIs it possible to split CView window with CSpliterWnd just like frame window? Pin
rambojanggoon17-Nov-09 8:20
rambojanggoon17-Nov-09 8:20 
QuestionCoin Change Problem Error Pin
DaliaMagdy17-Nov-09 4:51
DaliaMagdy17-Nov-09 4:51 
AnswerRe: Coin Change Problem Error Pin
mav@octaval17-Nov-09 4:59
mav@octaval17-Nov-09 4:59 
GeneralRe: Coin Change Problem Error Pin
EliottA17-Nov-09 5:27
EliottA17-Nov-09 5:27 
GeneralRe: Coin Change Problem Error Pin
LunaticFringe17-Nov-09 5:31
LunaticFringe17-Nov-09 5:31 
QuestionRe: Coin Change Problem Error Pin
Richard MacCutchan17-Nov-09 5:28
mveRichard MacCutchan17-Nov-09 5:28 
AnswerRe: Coin Change Problem Error Pin
David Crow17-Nov-09 5:51
David Crow17-Nov-09 5:51 
GeneralRe: Coin Change Problem Error Pin
Richard MacCutchan17-Nov-09 6:15
mveRichard MacCutchan17-Nov-09 6:15 
GeneralRe: Coin Change Problem Error Pin
josda100017-Nov-09 5:30
josda100017-Nov-09 5:30 
AnswerRe: Coin Change Problem Error Pin
anollipian17-Nov-09 7:02
anollipian17-Nov-09 7:02 
GeneralRe: Coin Change Problem Error Pin
CPallini17-Nov-09 7:10
mveCPallini17-Nov-09 7:10 
QuestionTransparent lines in C Pin
Rozis17-Nov-09 3:21
Rozis17-Nov-09 3:21 
AnswerRe: Transparent lines in C Pin
Code-o-mat17-Nov-09 3:38
Code-o-mat17-Nov-09 3:38 
GeneralRe: Transparent lines in C Pin
Rozis17-Nov-09 3:56
Rozis17-Nov-09 3:56 

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.