Click here to Skip to main content
16,011,804 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: creating menus in VC++ dialog application Pin
David Crow23-Sep-03 8:55
David Crow23-Sep-03 8:55 
QuestionGetClientRect with initial window wrong? Pin
Harco23-Sep-03 6:42
Harco23-Sep-03 6:42 
AnswerRe: GetClientRect with initial window wrong? Pin
cje23-Sep-03 9:00
cje23-Sep-03 9:00 
GeneralMFC ODBC Consumer Wizard Crashes Pin
Matt Gates23-Sep-03 6:22
Matt Gates23-Sep-03 6:22 
General[Message Deleted] Pin
imdx8023-Sep-03 6:05
imdx8023-Sep-03 6:05 
GeneralRe: Iterating Connection Names, Pin
Mike Dimmick23-Sep-03 7:32
Mike Dimmick23-Sep-03 7:32 
Generalwin95 global memory Pin
umarcool23-Sep-03 5:24
umarcool23-Sep-03 5:24 
Generalmenu Pin
sardinka23-Sep-03 4:31
sardinka23-Sep-03 4:31 
Please help
Here is my code. I was able to modified to go to main menu.
But If user enter a value outside the range it should not
go to the main menu. It should display only:
cout<<"Please enter 1 or 2 (3 to exit program):";
cin>>choice;
#include <iostream.h>
//using namespace std;
int main(void)

{
int choice;
float c; //Declare variable to be displayed.
float f;

//Question:Will it be the best practice to do
this: float c=0?
//Question:I used float, but I am not sure if in
this case better to use int or double?


for(;;)
// empty to promt a user to enter correct
choice value
{

cout<<"Please select the task to
perform:"<<endl;
cout<<"convert="" fahrenheit="" to=""
centigrade="" (1)"<<="" endl;
="" centigrade=""
fahrenheit(2)"<<="" cout<<"exit="" the="" program(3)"<<=""
="" do
="" use="" do-while="" loop
="" {
="" cout<<"please="" enter="" 1="" or="" 2="" (3="" exit=""
program):";
="" cin="">>choice;
switch (choice)
{
// use switch in order to do
validation and calculation
case 1:
{
cout<<"Enter value
in Fahrenheit:" ;
cin>>f;
c=((f-32)*5/9);
cout<<"The value
in Centigrade is:"<<c<<endl;
}
="" break;
="" case="" 2:
="" {
="" cout<<"enter="" value=""
in="" centigrade:";
="" cin="">>c;
f=((c+32)*9/5);
cout<<"The value
in Fahrenheit is:"<
GeneralRe: menu Pin
RobJones23-Sep-03 4:56
RobJones23-Sep-03 4:56 
GeneralRe: menu Pin
sardinka23-Sep-03 5:15
sardinka23-Sep-03 5:15 
GeneralRe: menu Pin
RobJones23-Sep-03 5:56
RobJones23-Sep-03 5:56 
GeneralRe: menu Pin
sardinka23-Sep-03 6:34
sardinka23-Sep-03 6:34 
GeneralRe: menu Pin
David Crow23-Sep-03 7:06
David Crow23-Sep-03 7:06 
GeneralRe: menu Pin
Atlantys23-Sep-03 8:01
Atlantys23-Sep-03 8:01 
GeneralRe: menu Pin
jhwurmbach23-Sep-03 21:18
jhwurmbach23-Sep-03 21:18 
GeneralRe: menu Pin
jhwurmbach23-Sep-03 5:18
jhwurmbach23-Sep-03 5:18 
GeneralRe: menu Pin
sardinka23-Sep-03 5:47
sardinka23-Sep-03 5:47 
GeneralRe: menu Pin
sardinka23-Sep-03 6:02
sardinka23-Sep-03 6:02 
GeneralRe: menu Pin
David Crow23-Sep-03 7:03
David Crow23-Sep-03 7:03 
Generalhelp on drawing application in VC++ Pin
swerajan23-Sep-03 4:31
swerajan23-Sep-03 4:31 
QuestionWhat Profiler message means ? Pin
vgrigor23-Sep-03 4:30
vgrigor23-Sep-03 4:30 
Generalmenu Pin
sardinka23-Sep-03 4:23
sardinka23-Sep-03 4:23 
GeneralRe: menu Pin
RobJones23-Sep-03 4:30
RobJones23-Sep-03 4:30 
GeneralRe: menu Pin
Chris Richardson23-Sep-03 11:04
Chris Richardson23-Sep-03 11:04 
QuestionWhat means such Profiler output ? Pin
vgrigor23-Sep-03 4:04
vgrigor23-Sep-03 4:04 

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.