Click here to Skip to main content
16,004,833 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: realloc function problem Pin
blue_rabbit3-Mar-07 20:19
blue_rabbit3-Mar-07 20:19 
GeneralRe: realloc function problem Pin
Ayman Mashal3-Mar-07 21:06
Ayman Mashal3-Mar-07 21:06 
GeneralRe: realloc function problem [modified] Pin
blue_rabbit3-Mar-07 21:12
blue_rabbit3-Mar-07 21:12 
GeneralRe: realloc function problem [modified] Pin
Ayman Mashal3-Mar-07 21:53
Ayman Mashal3-Mar-07 21:53 
GeneralRe: realloc function problem [modified] Pin
blue_rabbit3-Mar-07 23:36
blue_rabbit3-Mar-07 23:36 
QuestionRe: realloc function problem Pin
prasad_som3-Mar-07 20:29
prasad_som3-Mar-07 20:29 
AnswerRe: realloc function problem Pin
Ayman Mashal3-Mar-07 22:43
Ayman Mashal3-Mar-07 22:43 
QuestionCalculator Project Pin
Charles Covington3-Mar-07 12:50
Charles Covington3-Mar-07 12:50 
Im doing a calculator project for my c++ class but my operations dont compute properly and i cant quite figure out whats wrong any input would be greatly appreciated.

<br />
//Program Name: Calc<br />
<br />
//Author: Charles Covington<br />
<br />
//Date: Feb. 20, 2007<br />
<br />
//Description : This is a simple calculator<br />
<br />
#include <iostream><br />
#include <string><br />
#include <cmath><br />
using namespace std;<br />
//prototypes<br />
string upconv(string instring);<br />
void help();<br />
<br />
//begin main program<br />
int main () {<br />
//declarations<br />
double memory; //contains value in memory<br />
double display; //contains contents of display<br />
double number; //contains input number<br />
string strInput; //contains an operator or command<br />
char firstChar; //first char of input<br />
char secondChar; //second char of input<br />
int inputLength; //length of input<br />
<br />
//show user program description<br />
cout << "Enter ? for help" << endl;<br />
while(true) {<br />
//read input<br />
cin >> strInput;<br />
strInput = upconv(strInput);<br />
//extract first character<br />
firstChar = strInput[0];<br />
inputLength = strInput.length();<br />
if(inputLength==1) {<br />
switch(firstChar) {<br />
case '+':<br />
cin >> number;<br />
display = display + number;<br />
break;<br />
case '-':<br />
break;<br />
case '*':<br />
break;<br />
case '/':<br />
break;<br />
case '=':<br />
break;<br />
case '?':<br />
help();<br />
break;<br />
case 'I':<br />
break;<br />
case 'N':<br />
display = display * -1;<br />
break;<br />
case 'E':<br />
break;<br />
default:<br />
cout <<"Error invalid command" <<endl;<br />
}//end switch<br />
}//end then<br />
else { //2 character command<br />
if(firstChar == 'M') { //memory command<br />
secondChar = strInput[1];<br />
switch(secondChar) {<br />
case 'S':<br />
memory = display;<br />
break;<br />
case 'R':<br />
display = memory;<br />
cout << "Memory equals " << endl;<br />
break;<br />
case '+':<br />
display = memory + display;<br />
break;<br />
case 'C':<br />
break;<br />
default:<br />
cout << "Invalid memory command"<<endl;<br />
}//end switch<br />
}//end of<br />
else {<br />
}<br />
}//end else<br />
cout << display << endl;<br />
}//end while<br />
<br />
return 0;<br />
}//end main<br />
<br />
<br />
<br />
string upconv(string instring) {<br />
string newstring=instring;<br />
int len = instring.length();<br />
for(int i=0; i<len; i++) {<br />
newstring[i]= toupper(instring[i]);<br />
}//end for<br />
return newstring;<br />
}//end upconv<br />
<br />
void help() {<br />
//display help screen<br />
cout << "HELP" << endl;<br />
}<br />


Charles Covington
AnswerRe: Calculator Project Pin
prasad_som3-Mar-07 17:53
prasad_som3-Mar-07 17:53 
AnswerRe: Calculator Project Pin
Newbie004-Mar-07 0:52
Newbie004-Mar-07 0:52 
Questionfast way 2 adjust contrast??? Pin
samreengr83-Mar-07 11:18
samreengr83-Mar-07 11:18 
QuestionRe: fast way 2 adjust contrast??? Pin
Mark Salsbery5-Mar-07 7:00
Mark Salsbery5-Mar-07 7:00 
AnswerRe: fast way 2 adjust contrast??? Pin
Rilhas5-Mar-07 13:38
Rilhas5-Mar-07 13:38 
Questionhow do i connect to SQl SERVER WHIT vc++.NET? Pin
Ehsan_aminian3-Mar-07 11:10
Ehsan_aminian3-Mar-07 11:10 
AnswerRe: how do i connect to SQl SERVER WHIT vc++.NET? Pin
Hamid_RT4-Mar-07 5:18
Hamid_RT4-Mar-07 5:18 
QuestionOpinions solicited - naming of access methods... Pin
charlieg3-Mar-07 7:47
charlieg3-Mar-07 7:47 
AnswerRe: Opinions solicited - naming of access methods... Pin
Maximilien3-Mar-07 10:39
Maximilien3-Mar-07 10:39 
QuestionMenu management on dialog based project Pin
ilgale3-Mar-07 6:27
ilgale3-Mar-07 6:27 
AnswerRe: Menu management on dialog based project Pin
Tony Hill3-Mar-07 9:14
professionalTony Hill3-Mar-07 9:14 
QuestionBest Book? Pin
Dirso3-Mar-07 5:20
Dirso3-Mar-07 5:20 
AnswerRe: Best Book? Pin
Rajesh R Subramanian5-Mar-07 23:54
professionalRajesh R Subramanian5-Mar-07 23:54 
QuestionHiding program from task manager. Pin
AprNgp3-Mar-07 4:38
AprNgp3-Mar-07 4:38 
AnswerRe: Hiding program from task manager. Pin
Waldermort3-Mar-07 5:15
Waldermort3-Mar-07 5:15 
AnswerRe: Hiding program from task manager. Pin
Newbie003-Mar-07 5:15
Newbie003-Mar-07 5:15 
AnswerRe: Hiding program from task manager. Pin
Gochha3-Mar-07 6:38
Gochha3-Mar-07 6:38 

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.