Implement a simple calculator.  \nThe calculator will execute basic arithmetic operations (add, subtract, multiply, divide and  raise to the power) with decimal numbers and prints the current result when asked by the user.  \nThe calculator keeps track at all time of the minimum and maximum calculated results.  \nThe operator is given first and the operands after it on another line separated by whitespace.  \nThe user is assumed to know how to use the program and therefore the program does not need to react to any unspecified errors.  \n\nWrite a C++ program that :\n-prints a prompt “>” on the screen \n-waits for user input on the same line where the prompt is printed.  \nThe input must be one of the following commands:\n-Once the operation command is typed :\noif it is a +, - , / ,*  or P  the program waits for user input in the form of two numbers separated by a whitespace.\noif its is an =, H, M or Q the program prints an appropriate message.\n-Several calculations can be done
199763
This sounds like school work, its a fairly simple program. you will probably want to use the cout and cin function which needs you to include iostream.h \n\nsimply use cout to print to screen, ask for input etc. then take the input using cin and store it to a int variable.\n\na good way to do it would be to ask the user what they wish to do, eg subtract, divide and take that operator first, a symbol or a number to show choice. then the next line asks for the numbers to be input.\n\neg:\n\n---------\n\nHello. what do you wish to do:\n1 - subtract\n2 - divide\n3 - etc etc\n\n>\n\n-------------\n\nthen use an if function or maybe a switch to check what their input was and do the artithmatic.\n\nso a very basic prgram may look like this:\nit may have errors i havant checked it.\n\n-----------------\n\n#include <iostream>\n\nint main() \n{\nint number;\n\n    cout << "Hello, input a number" << endl;\n    cin >>number;\n    return 0;\n}\n\n------\n\nEDIT; i re read the req, you might find inputting the selection to a char better, then check the char to see what symbol is stored in it, eg + / -. and maybe use a char array for the number input. simple take the char array, check for the space. split the numbers into 2 and caste then to an int. sounds complicated but it isnt to hard.\n\nsorry about spelling mistakes.
656475
import java.io.IOException;\n\npublic class PosNeg {\n\npublic static void main(String[] args) {\n\nint [] wNumbers;\nwNumbers = new int[5];\nchar c = ' ';\n\nfor (int i=0;i<5;i++) {\nSystem.out.print("Enter the #"+i+": ");\ntry {\nwNumbers[i]=System.in.read()-48;\nif (wNumbers[i]<0)\nwNumbers[i]=(System.in.read()-48)*-1;\nwhile (System.in.read()!='&#92;n'){\n}\n} catch (IOException e) {\ne.printStackTrace();\n}\nSystem.out.print("The number you entered is ");\nif (Math.abs(wNumbers[i])!=wNumbers[i])\n   System.out.println("negative.");\n else\n   System.out.println("positive.");\n}\n}\n}
64651
CHOOSE one of the follwing depending upon your course curriculum\n\n\n//Use to following program for multiple calculations in one \n//run.\n\nvoid main()\n{\n\nint a,b; // Declare variables "a" and "b" to get two\n// numbers.\n\n  char Continue = 'Y'; // Declare Continue to loop through \n//the program for multiple calculations. and initialize it \n//to 'Y'\n\n  while(Continue == 'Y' || Continue == 'y') \n// Continue doing the folliwing if the user presses 'Y' for\n// continue.\n  {\n\n  printf("Enter First Number: ");\n  scanf("%d",&a); //scan or get first number\n\n  printf("&#92;nEnter Second Number: ");\n  scanf("%d",&b); //scan or get second number\n\n  printf("&#92;n %d %d  &#92;"DIVISION&#92;" = %f",a,b,(float)a/b); \n// Divide and display the result\n\n  printf("&#92;n %d MOD %d  &#92;"MODULUS&#92;" = %d",a,b,a%b); \n// Calculate Modulus.\n\n  printf("&#92;n&#92;n Do you want to Continue? (Y/N)  :"); \n// Prompt if youser wants to continue.\n  scanf("%s",&Continue);\n\n  printf("&#92;n &#92;n --------------------------------- &#92;n &#92;n"); \n// print saperator between multiple calculations.\n  }\n}\n\n-------------------------------------------------------------------------------------------------------\n\n// Use Following for single calculation in one run...\nvoid main()\n{\n  int a,b; // Declare variables "a" and "b" to get two\n// numbers.\n \n  printf("Enter First Number: ");\n  scanf("%d",&a); //scan or get first number\n  \n  printf("&#92;nEnter Second Number: ");\n  scanf("%d",&b); //scan or get second number\n  \n  printf("&#92;n %d %d  &#92;"DIVISION&#92;" = %f",a,b,(float)a/b); // \n  // Divide and display the result\n  \n  printf("&#92;n %d MOD %d  &#92;"MODULUS&#92;" = %d",a,b,a%b); \n  // Calculate Modulus and print.\n\n}\n\n\nNote: You can not use floats in modulus.
263944
Hi,\n\nYou can start reading the basic section in C++, they teach you on what are variables, what are datatypes, and what are loops.\n\nThey will teach you how to use arrays and loops and conditionals.\n\nThat is your best bet...\n\nPick up any standard C++ book and read he intro to programming!
30877
Looks like you've got two different questions here. I'll answer the first one. \n\nTo put the Calculator on your tool bar, right-click on the Calculator icon and choose Create Shortcut. Then click anddrag the new shortcut onto the toolbar.
91689
The quick answer is that you would know how to program in c++. I dont think most people would want to write that for you just to give an answer but you never know. \n\nTry using planetsourcecode and see if you can find something similar enough to modify...
483979
/*\nA simple program that calculates the LCD/LCM of two ints\nWITHOUT THE using GCD methode!!\nbtw, always write your own damn code lol!\n*/\n\nimport java.util.Scanner;\n\npublic class Program {\n\npublic static int lcm(int[] array) {\n\nint count = array.length;\nint X = array[0];\nint i = 0;\n\nwhile( true ) {\n\nif( (X % array[i]) == 0 ) {\nif( i >= count-1 )\nbreak;\ni++;\n}\n\nelse {\nX += 1;\ni = 0;\n}\n}\nreturn X;\n}\n\npublic static void main(String[] args) {\n   \nSystem.out.print("Enter two nonzero integers: ");\n    Scanner keyboard = new Scanner(System.in);\n    int[] array = new int[2];\n    for(int count = 0; count < 2; count++)\narray[count] = keyboard.nextInt();\n    System.out.println("LCD is: " + lcm(array));\n    }\n}
2251
i dont know in what environment you work, but a C++ program would look like this:\n#include<iostream.h>\nint n,a[10][10],i,j;\nvoid main()\n{cin>>n;\n for (i=0;i<n;i++)\n   for (j=0;j<n;j++)\n      {\n       cin>>a[i][j];\n       if (a[i][j]==0) cout<<i<<" "<<j<<"&#92;n";\n      }\n}
98517
I am giving the solution in C++ using recursion..\n\n!!\n\n#include<iostream.h>\nvoid printstars(int n)\n{\nfor(int k=0;k<n;k++)\n     cout<<"*";\ncout<<endl;\n}\nvoid print1(int n)\n{\nif(n<=1)\n   printstars(n);\nelse\n   printstars(n-2);\n}\nvoid print2(int m,int n)\n{\nif(m==n)\n   cout<<endl;\nelse \n{\n   printstars(m);\n   print2(m+2,n);\n}\n}\n\nmain()\n{\nint n,m=1;\ncout<<"Enter an odd number n";\ncin>>n;\nprint2(m,n);\nprint1(n);\n}\n\nThis produces the output u needed and also uses recursion.
28367
-1 works\n-1*3 + 1 = -2\n-2/2 = -1 (back to where we started)\n\nAddition> Now you say they should be pos! Jeez\n\n0 works though is it technically positive?\n\nWow, try a number like .1  - The numbers get REALLY big before coming back down to 1.  (5.00315450989997E+15)\n\n\n  Function IsOddNum(ByVal intNumber As Double) As Boolean\n    If (intNumber Mod 2 = 0) Then\n      Return False\n    Else\n      Return True\n    End If\n  End Function\n\n  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click\n    Dim num As Double = Convert.ToDouble(TextBox1.Text)\n    Dim count As Integer = 0\n    Literal1.Text = num.ToString() & "<BR>"\n    While num <> 1 And count <> 1000\n      If IsOddNum(num) Then\n        num = 3 * num + 1\n      Else\n        num = num / 2\n      End If\n      Literal1.Text &= num.ToString() & "<BR>"\n      count += 1\n    End While\n  End Sub\n\n\nAnother Note:  I just plotted the number of iterations for the numbers between 1 and 20,000.  The graph totally shows a pattern!  (Mathematicians love patterns)\n\nAnother Note, Doh, now the numbers have to be integers?  Jeez, there goes my repeating number answer.  Are you going to keep adding rules every time I get it right? LOL
107200
Here it is:-\n\n/* Convert.cpp */\n/* Display the reverse of the input */\n/* By Senthil */\n\n#include <iostream.h>\n#include <conio.h>\n#include <string.h>\n\nvoid main()\n{\nchar inp[10];\nint cnt = 0, ex = 0;\nclrscr();\n\ncout<<"Enter some characters (max limit 10) : ";\ncin>>inp;\n\ncnt = strlen(inp);\ncnt--;\nfor(ex = 0;ex != cnt;ex++,cnt--)\n{\ninp[ex] = inp[cnt];\n}\ncout<<"The reverse of the string is : "<<inp;\ngetch();\n}
84879
I already answered this for you in your other thread, using Visual Basic. With a little effort, you ought to be able to convert one type of Basic to another. The languages are virtually identical.\n\nOnce again, what you need to do is create a function. Let's call it DozenBetType. It is going to take one argument: an integer: DozenBetType(someInteger)\n\nThe function is going to return:\n1 if the number passed to it is 1-12\n2 if the number is 13-24\n3 if the number is 25-36\n\nThen you can simply call the function on both the number guessed and the number your program has generated.\n\nFor example, if the number your program generated is declared as intResult, and the number the person guessed is declared as intGuess:\n\nif DozenBetType(intGuess) = DozenBetType(intResult) then they have won the bet, otherwise they have not. (A simple if-then-else statement\n\nIf you don't want to use a function, or if that's too complicated for you, you can declare two new variables: intDozenTypeResult, for the number your program generated and intDozenTypeGuess, for the number your user guessed.\n\nSet intDozenTypeResult to be 1 if the program's random number is between 1-12, set it to be 2 if the value is 13-24, set it to be 3 if the value is 25-36. \n\nDo the same thing for intDozenTypeGuess.\n\nThen, simply compare those two variables:\n\nIf intDozenTypeResult = intDozenTypeGuess then they have won, otherwise they have not (again, a simple if-then-else statement).\n\nPlease, don't create new threads for the same question. Just update your old question.
138920
Use the calculator on your computer...
50958
The code below will work.\n\nint main()\n{\nint aNum,i;\ncout<<"enter a number";\ncin>> aNum;\nfor(i=0;i<aNum;i++)\n{\nfor(j=0;j<=i;j++)//nested loop\ncout<<"*";// end of nested loop\ncout<<'&#92;n';\n}// end of outer loop\nreturn 0;\n}
577535
Learn the basics of Visual Basic and write a program for a simple calculator (like the one that comes built in to Windows). It's incredibly easy to write (only about a dozen or so lines of code), but seems impressive to most non-computer oriented people.
523201
u have to ponit it or use\n\nthese are the 2 way's:\n\n#include <iostream>\nusing namespcae std;\nint main()\n{\nint num[8];\nint index;\n\nnum[0] = 42;\nnum[1] = 2001;\nnum[2] = 7;\nnum[3] = 180;\nnum[4] = 99;\nnum[5] = 1993;\n\nfor(index = 0; index <= 5; index++)\n{\nstd::cout<< index[num] << endl;\n}\n system("pause");\nreturn 0;\n}\n\nor\n\n#include <iostream>\n#define MAX 20\nusing namespcae std;\n\nint main()\n{\n\nint a[MAX] = {23,43,4,5,34,343,12,14};\nint b;\n\ncout.setf(ios::right);\n\nfor(b = 0; b < MAX; b++){\n\ncout << endl << endl;\n\ncout << "The Elemnt in ";\n\ncout.width(2);\n\ncout << (b +1) << " is ";\n\ncout.width(2);\n\nstd::cout << b[a];\n}\nreturn 0;\n}
317410
include <stdio.h>\n\nvoid main(){\n   float no;\n   scanf("%f",&no);\n   if(!( ((int)no)%7!=0 || ((int)no)%2==0 )) \n      printf("No is divisible by 7 and not divisible by 2");\n}\n\nsalam