C :: Identifying Conic Sections?

Oct 6, 2013

I just finished a program on how to Identify any kinds of conic sections like circle,hyperbola, parabola and ellipse.

I dont about the other codes, they work but I think they are wrong.

I need to finish so that I can proceed to another program, I need to find what is the wrong in this equation, I dont know why the answer for eccentricity and others are different If I solved it manually.

View 10 Replies


ADVERTISEMENT

C :: Split Array Into Sections Of 2 Values

Mar 16, 2013

i want to split the array into sections of 2 values, recursively. the objective its to do the average.i have this input and output, that its correct:

> media_recursiva a 1 a 2 a 4 a 5 a 2 a 3 a 5 a 6
1.000
1.500
3.000
3.500

("a 1" means add the value 1)

but mine its wrong, it gives to me this:

1.000
1.000
2.500
3.000

Code:

float media(int arr[], int count) {
while(count != 0){
if(count==1)
return arr[0];
else if(count ==2){
return ((arr[0] + arr[1])/2);

[Code]....

View 5 Replies View Related

C++ :: Identifying Cause Of Deleting Released Memory?

Oct 14, 2014

I have a particular class hierarchy that is causing memory to be released twice.

What seems to be the problem is the following section of code:

void FOO::ProcessTable (const TABLE & table)
{ SQLERRsqlerr;
const KEYDEF * prikey;
stringtemp;
TABLEDEFtabledef (table);

An exception is getting thrown several levels deep in TABLEDEF's construction. I know why the exception is being thrown and how to fix it. That's not the issue. The problem is that the exception handling is unwinding objects on the stack and calling TABLEDEF's destructor, which in turn calls every other destructor in the hierarchy all the way to std::string which is the base class. string's destructor is calling delete which is causing an abend attempting to release memory that is not allocated. I know the underlying string was in fact allocated and correct.

Before I fix the cause of the exception being thrown, I want to find why string memory is apparently getting released twice. I've checked all the constructors in the chain and all are passing objects as const reference to the next level. All the destructors are virtual.

how to find the cause of the memory being released twice? I've tried various strategies in the debugger to no avail, including setting a memory access breakpoint on the underlying string object.

Note: The try/catch logic is one level up from this function.

View 7 Replies View Related

C++ :: Identifying Error In Factorial Function

Apr 8, 2014

double expression(int n, double x) {
double num=(pow((x),2*a));
double den=fact(n,a);
double sum=0;
for(int a=0; a>=0; a++)
sum=pow(x,n)*(num/den);
return sum;
}

I don't know why this isn't working. fact is a factorial function which I have tested and it works fine. But when I input, for example:

int main() {
cout<<expression(1,3)<<endl;
getch();
return 0;
}

it comes up with an error.

View 5 Replies View Related

C# :: API That Convert 2D Cross Sections Into 3D Shape

Mar 1, 2014

I have cross sections in the form of rectangles in the XY plane formed from two point (top left, bottom right) as well as their Z position. I'd like finding some sort of API that can extrude a basic linear-average-approximated 3D shape (preferably eventually into STL format) from these points. I've tried googling but to no avail. The aim is to build a 3D shape from 2D wireframes.

View 2 Replies View Related

C++ :: Output Sections Of Txt Code In Random Order

Mar 27, 2014

I will keep this simple as I have the code written for my testing software program, I just want to add a feature of randomly generating the answer choice output order, I do not want to randomly output the full questions, but instead the choices (answers to the question), for example =

#include <string>
#include <iostream>
#include <limits>
cout <<" " << endl ; \ space

[Code] ....

As you can see I would like to output the answers, choices randomly as in answer choice 3 will appear at the top instead of 1. and so on, it doesn't matter if the numbers move with the txt as the numbers beside the
questions are txt.

It's a 32bit console application.

View 4 Replies View Related

C++ :: Identifying Palindrome Words - Running Into Segmentation Fault

Jul 16, 2013

I have written this program with the intention of identifiying palindrome words. Why I am running into a segmentation fault ?

Code:
#include <vector>
#include <iostream>
#include <string>
bool is_palindrome ( const std::string & s )

[Code] .....

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved