English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I recently missed 2 class periods in my computer programming course and now I am far behind and I need someones help, don't worry the following programs are examples and are not for a grade in any way or form - need to know how to do these so I can get my hw done.

1) Write a switch statement that, for two given integers A and B, and a give character operation, computes and displays A + B, A - B, A * B, or A / B according to whether operations is +, -, *, /, and display displays and illegal-operator message if it is not one of these.

2) I will post example 2 on a more later date

Anyway there you have it and I would appreciate any remarks, hints, and advice you have on this matter. Just so its clear this program is just an example and doesn't count for a grade, just needs to be made known to me so I know how to do my hw programs and tests.

Please / Thank you.

2007-03-08 04:52:36 · 5 answers · asked by gatz1000 4 in Computers & Internet Programming & Design

5 answers

Go to your school's lab during the professor's LAB HOURS. You can get help outside of class time that way.

2007-03-08 05:25:07 · answer #1 · answered by Richard H 7 · 1 0

hi, to respond to your question, in spite of if it is not laptop correct, then you definately will ought to concentration on the sector of the activity. Say, i'm employing for a activity in a vehicle production employer the sector here could be Mechanical. Saftware : CAD(laptop aided designing). Hardware : CNC gadget, Lathe gadget. further for various fields the hardware and alertness skills selection. nevertheless in many fields you will locate laptop as a complication-free denominator. and so observe, excel can conceal the common application skills.

2016-12-14 14:01:37 · answer #2 · answered by barsky 4 · 0 0

int A = 10;
int B = 10;
char opc;
cout << "enter operation: ";
cin << opc;

switch(opc)
{
case '+':
cout << "A + B = " << A+B << endl;
break;
case '-':
cout << "A - B = " << A-B << endl;
break;
case '*':
cout << "A * B = " << A*B << endl;
break;
case '/':
cout << "A / B = " << A/B << endl;
break;

default:
cout << " illegal operation" << endl;
}

I guess the important thing is to remember your "break" statements because they are real easy to forget.

2007-03-08 05:14:02 · answer #3 · answered by bytekhan 2 · 1 1

Send me all your C++ questions.
I will send you the answers
iyiogrenci@yahoo.com

2007-03-08 05:12:17 · answer #4 · answered by iyiogrenci 6 · 1 1

switch( operator)
{
case '+' : printf( "A + B = %d", A+B );
case '-' : printf( "A - B = %d", A-B );
case '*' : printf( "A * B = %d", A*B );
case '/' : printf( "A / B = %d", A/B );
default : printf( "Operator unknown." );
}

2007-03-08 05:07:21 · answer #5 · answered by jondawg 4 · 1 1

fedest.com, questions and answers