The code I've written is for your basic invoice class. The issue I'm having is that the program works fine for the first invoice, but when I add a second object the program skips over the part where the user types in a part description.
#include <iostream> #include <string> using namespace std; class Invoice { public: void setPartDescription( string description ) {
[Code] ....
I thought maybe the "string description" I have in main being shared by both invoice objects might be causing the issue but I couldn't manage to resolve it by tinkering. Again the code works fine for the first object, the second and so forth mess up. I've attached a file showing when the part description gets skipped over (and it doesn't just default to the first input, it gets left blank).
Suppose there are two cpp programs and we want the user to put the complete path of the first cpp file into second cpp file while it(second file) is running and compile and show the output there, so how can this be done?
I am trying to write a program that prints a 2d array to the screen and then compares each row and column to see if there is any pairs of letters. basically something that looks like this:
--------------------------- V T A Y U C B D F W Q Q C R D A L Y M F G O A S S D T I
Number of horizontal pairs: 2 Number of vertical pairs: 3 ---------------------------
so far this is my code below, but i dont know how to approach the comparisons
Code:
#include<stdio.h> #include<stdlib.h> #include<time.h> int main( void )
How can i count total number of each topic separately? For example total number of topic 1 between all nodes. To begin enter 10 and 7 to initial node number and number of topic.
Add a square root function to the rational class. Have your program print the square root of any rational number. I want to find the square root for numerator and denominator separatetly. divide the answer to get decimals and convert the decimal to fractions. i got till geting the decimal but i want to convert it back to a simplified fraction
// finding greatest common factor int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); }
how to take two variables with values such as a 1; and b 2;. Now you take cout << a + b; and you will get 3, but I want to somehow have a 1; b 2; and c num; then have a + b = c. So what ever I have the user input is for a and be added together will become the value of the c variable.
I am programming an application in c# that allows the user to edit images. The user can use a Pen to write on the image, and the user can also use a highlighter (a big semi-transparent Pen) to highlight what they've written. I need the user to be able to erase only the highlighting without erasing the pen drawings.
My solution was to have the user draw on one graphics window when the pen is selected and draw on the other graphics window when the highlighter is selected. I will then enable the eraser on either graphics window depending on what the user wants to erase.
My program will let the user save the image and then load it into the program again for later editing. When I save the image, I have to compress the layers (different graphics windows) into one bitmap. When I load the bitmap back into my application, I lose my layers and cannot erase just the highlighting without also erasing the pen as well.
How can I save an image file with layers, and then recover the layers when my program starts up again?
I am not opposed to saving two images - one with the pen graphics window and the other with the highlighting. If I do that, how can I merge the two images into one layer when I load the images back into my program?
Code: #include <math.h> #include <stdio.h> int main(void) { float a,b,c,root_1,root_2; printf("Please enter value a from the quadratic equation
[Code] ......
And I keep getting this error:
Code: /tmp/ccgtUIun.o: In function `main': assign345.c:(.text+0xc7): undefined reference to `sqrt' assign345.c:(.text+0xef): undefined reference to `sqrt' collect2: ld returned 1 exit status
I have a small project for school due today but i cant get my head around programming
Ive to create a program where ive to get the values from the user and add them to an equation. I have also to add a selection statement where it will ask for the material being tested which will have its value set in the program.
Write a program that creates the output shown in the Output Layout section below. The program should create 2 points with x and y coordinates as integers, prompt the user to input the x and y values for one of the points and randomly set the other (-99 to 99 range) and output the length of the radius line segment and the area of the circle that radius defines. The program should then end. Include an SDM for the program and any other appropriate documentation.
Special Calculations: Distance between 2 points equation: √((p0x – p1x)2 + (p0y – p1y)2) (This requires use of the math library)
Output Layout: (bold text represents user input)
Please enter the location of your first point. Enter a value from -99 to 99 for your x coordinate: -2 Enter a value from -99 to 99 for your y coordinate: 17
The location of your second randomly set point. Your x coordinate: 45 Your y coordinate: -89
The length of the radius line segment from point one to point two is 115. The area of the circle with a radius of 115 is 41546.33.
I am creating a program that solves the quadratic equation ax^2 + bx +c.
I have this program almost complete except the output of the equation in the function called display_quadratic. I need the program to display the variables a,b,c in the equation ax^2 + bx + c but I am having 2 problems. My first problem is that I cannot get the right addition and subtraction signs for the equation.
For instance, if the program had the values for a,b,c as 2,2,3
it will display 2x^2 2x 3
How can I get it to display 2x^2 + 2x + 3? or if it was negative like 2x^2 - 2x - 3?
My next question is how do I get to not display the coefficients that are 1?
I had an if-else statement but no matter what I created it would overlap with another statement and print out twice. Here is the code:
I am having trouble understanding how this loops would work. Give the function (x*x*x*x) - (10*x*x*x) + (35*x*x) - (50*x) + 24 Write a program that will use bisection method to find the roots of this function. Define lower limit and upper limit (e.g. -1.05 and 6.05) Starting at the lower limit step along the X axis at intervals of 0.1 for H calculating the function values f(x) and f(x +h), then f(x+h) and f(x+2h) until the upper limit is exceeded. If sign of the function value changes this indicates a root between ranges. Apply bi sectional method to this range until root has been found with an epsilon of 0.000001, then continue on until upper limit has been exceeded and all 4 roots found. If the function is within 0.000001 of zero then root has been found therefore no need for bi sectional method.
Code:
#include "stdafx.h" #include "math.h" #define H 0.1 #define epsilon 0.000001 double F(double x); int main(void)
[code]....
So we have a function and a range. Program requires to work along the X axis at 0.1 increments until it reaches a point where the value changes from positive to negative or negative to positive. Then apply bisection method within that range to a given accuracy then print that root. Then continue on X axis until the next change of sign is found.
This is my code for the quadratic equation. It keeps telling me that my else is illegal since no matching if statement and my else statement is missing a statement
#include <iostream> #include <cmath> #include <string> #include <iomanip> using namespace std; int main() { string Name;
I've written a program that finds the maximum of a function. I now want to change it a little so that instead of evaluating the function y=x^2-7x-18, the program will ask the user to input an equation and then evaluate that equation. I'm really not sure of how to do so.
#include <iostream> #include <cmath> #include <cstdlib> using namespace std; int main() { int a, b, delta, x, y; double max= -1.8 * pow(10, 308);
I want to find the root of an equation f(x) by using the secant method [URL] .....
#include <math.h> #include <iostream> using namespace std; //Define function f(x) double f(double x, double a, double b) { return sin((a*x)/(1+x*x))*atan(b*x)+atan(x);
[Code] ....
1) Do I have to keep the function f and RootFinderSMNew in different cpp files?
So, I successfully made a program that will perform the quadratic equation on three numbers, imaginary or real. however, i am now trying to simplify the result, as to get rid of the "/2a" on the bottom. Hence the simplify() function. I just started to create the simplification function, and am attempting to divide the imaginary part of the solution as well as the real part of the solution by 2a. Somehow, it gives the error, "error:invalid operands of types 'int' and 'double *' to binary 'operator*'" on lines 105 and 106. I suspect it has to do with the pointers and references that i am passing as parameters. Also, just an aside, I have never actually seen "/=" be used. It can be, right? I know "+=" can be.
#include <iostream> #include <string> #include <cmath> #include <cstdlib>//simplify the answer using namespace std; int count=0; //prototyping double ans_1(double,double,double);
I am using matlab R2o11 in which the programming medium is c++. I am having these variables=
T=373 t0 376 V=0.09 to 1 P=T/V
I just need a result showing ... First it should take T=373 and solve the equation using all volume values. Then it takes another temperature and do the same.
I need an equation that determines the lowest possible cost for laying power line.
The variables are as follows:
1. The width of a river 2. The distance a factory is downstream from a station on the other side of the river. 3. The cost for laying line underwater. 4. The cost for laying line on land.
All these variables will be user input each use of program.