473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

simple for you hard for me

Need script that does the following.

1. Ask student if he wants multiplication or addition
2. How many problems would he like?
3. whats the highest number used in the problem?


thanks

im stupid thats why im here asking you :D
Oct 10 '06 #1
2 1708
ooh forgot to mention programmed in C not C++
Oct 10 '06 #2
#include <stdio.h>
#include <conio.h>
int main()
{
float a,b,max,c=0,temp;
int ch;
clrscr();
do
{
clrscr();
printf("\nEnter the two values : \n");
scanf("%f",&a);
scanf("%f",&b);
printf("Enter\n1: addition\n2: subraction\n3: multilication\n4: division\n5: To check maximum number entered till now \n6: Exit");
scanf("%d",&ch);
if((a>temp)||(b>temp))
{
if(a>b)
{
max=a;
temp=max;
}
if(b>a)
{
max=b;
temp=max;
}
}
switch (ch)
{
case 1:
printf("\nThe addition of those two values are : %f",(a+b));
break;
case 2:
printf("\nThe subraction of those two values are : %f",(a-b));
break;
case 3:
printf("\nThe multiplication of those two values are : %f",(a*b));
break;
case 4:
printf("\nThe division of those two values are : %f",(a/b));
break;
case 5:
printf("\nThe maximum number entered from the begning of the program is : %f",max);
break;
case 6:
printf("\nPress any key.......");
c=1;
break;
}
}while (c!=1);
getch();
return 0;
}


Here is the code....for u....if any thing to know more please send me a mail






Regards
Rajesh G
rajeshg@infotechsw.com
Oct 27 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: cppaddict | last post by:
Hi, I am deleting some objects created by new in my class destructor, and it is causing my application to error at runtime. The code below compiles ok, and also runs fine if I remove the body...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
6
by: Burt | last post by:
I need to put up a simple modal dialog, and am surprised how hard it seems to be. Am I missing something here? I have created a dialog resource IDD_DELETE_S9. It has some static text plus 3...
2
by: Lei Wu | last post by:
Hi, guys, As an Internet developer for many years, I thought I knew HTML... until I came across this: The following two tables look different in IE 6.0. I've pinpointed the cause -- the hard...
4
by: Peter Otten | last post by:
QOTW: "It's hard to make a mistake by having too many short and simple functions. And much too easy to make them when you have too few ;-)" - Thomas Bartkus "Argh, the following is valid Python...
6
by: Arne Beruldsen | last post by:
I have a very simple Access data base. No new info is going to be added...the only changes are to existing fields. I have 2 tables both with one row each. I'm using vb.net. I can easily...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
4
by: mattmao | last post by:
Greetings everyone. I am a college student studying in the University of Technology, Sydney. PHP is not in my studying plan, I am taking subjects about J2EE in this semester. However I do...
2
by: kj | last post by:
I'm sure this is a simple, but recurrent, problem for which I can't hit on a totally satisfactory solution. As an example, suppose that I want write a module X that performs some database...
7
by: CSharper | last post by:
Yesterday I had a heated discussion with my colleagues on what is a data centric application and having business logic in sql. I have group of people who wants to include all the business logic in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.