C :: Finding About Maximum / Minimum Point

Oct 29, 2014

A function finds approximate maximum or minimum point of a second degree polynomial function (the point where the derivation will equal to zero ). The input polynomial function will be in the following format:

x2 + bx + c = 0 .

Your C function should take a , b and c as input parameters. Your C function also should take the srch_starting_point and stp_sze from the user. Finally, print the resulting maximum or minimum point (m_x, m_y) and step count (n_step) in your function.

For example, if the input is (a, b, c, srch_starting_point, stp_sze );
1 1 1 -3 1

Output similar to;
Maximum point results ( m_x, m_y, n_step )
-1 1 2

i can find the minimum point at first(Using derivation). After choosing starting point, staating point gets lower step size by step size. I can compare numbers to the minimum number. Afterwards, to find m_y i put m_x in the function. Finally, I put a counter to count steps.

View 4 Replies


ADVERTISEMENT

C++ :: Finding Maximum And Minimum Values Of 10 Numbers Using For Loop

Jan 22, 2013

I want to finding maximum and minimum values of 10 numbers using for loop and the program work wrong !!

#include <iostream>
using namespace std;
int main() {
int x;
int max = -999999999;
int min= 999999999;

[Code] ....

View 2 Replies View Related

C :: Minimum And Maximum In All Positions

Jan 4, 2015

I wrote a program to find the minimum and the maximum values from a vector. It works fine. What I'm trying to do is show the positions of said values and it's not working quite right. When I insert 4 elements: 2 0 1 3 it says:

"The min and max are 0 and 3
The position of the min is: 01
The position of the max is: 03"

What am I doing wrong? Here is the code:

Code:

#include <stdio.h>
#include <conio.h>
int main() {
int A[10], i, j, n, min, max, C[10], k=0, D[10], l=0;
printf("Insert no. of elements in vector A

[code]....

View 6 Replies View Related

C :: Display Average / Maximum And Minimum Mark

Sep 29, 2013

Program that reads 10 students marks and display the average, the maximum and the minimum marks.

Code] ....

#include <Stdio.h>
main(){
// Local Declarations
int marks[10];
int i; /*loop counter */
int avg;
int sum = 0;

[Code] ....

In this program i am able to get Average Marks and Minimum Marks But i am not able to get the Maximum Marks Output correct.

View 6 Replies View Related

C++ :: Setting Maximum And Minimum Numbers In A Series?

Dec 6, 2013

I need to write a program that not only calculates the minimum and maximum, but also calculates the average and the difference between the largest and the smallest.

Here's the code:

#include <iostream.h>
#include <conio.h>
#inlcude <math.h>
#include <windows.h>

[Code].....

I know the problem is the "sdt::cin" but I don't know what else to do

View 1 Replies View Related

C++ :: Displaying Maximum / Minimum And Average Temperature

Dec 31, 2014

I am given two month's data (Max, Min, Ave) for every day in that month.

The task is to display all 3 of that data for any selected day in that 2 months.

View 3 Replies View Related

C++ :: 3 Integer Numbers - Find And Print Mean / Maximum And Second Minimum

Oct 25, 2014

The question is: Write a program that reads 3 integer numbers, then finds and prints the: Mean - Maximum & Second Minimum.

#include <iostream>
using namespace std;
int main () {
double a, b, c;
cout<< "Please enter three values"<<endl;

[Code] .....

View 6 Replies View Related

C++ :: Make Average / Maximum / Minimum Score To Output File?

Nov 3, 2013

i have to make a score average, minimum, maximum as statistics for the out file. here is the code i have done:

Code: #include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>

[Code].....

View 1 Replies View Related

C :: Finding The Minimum Value Of Array

Sep 9, 2013

I am trying to make my program read a bunch of numbers in an array to find its maximum and minimum. the program will ask the user to enter in as much number as possible until they enter a non number/letter. i got my program to find the maximum value but the program couldn't read the minimum value. it always says zero. also everytime i enter the number 0, the program will just finish its loop statement. If i typed in a negative number, it'll read the negative number as its minimum.

Code:
#include <stdio.h>
int main()
{
//-------variables------------------
double list[1000]; // can hold 1000 items
int i;
char letter;
int max = list[0];
int min = list[0];

[Code] ....

View 5 Replies View Related

C :: Finding Minimum In Two Dimensional Arrays

Mar 30, 2014

I am having a little trouble finding the minimum value in my two dimensional array. I feel like my code is right, but it could be returning the wrong value. Below is my code, this is just my "minimum" function!

Code:
int minimum( int array[][MAX], int size ) {
int i,j,min;
for( i = 0; i < size; i++ ) {
for( j = 0; j < size; i++ ) {
if( array[i][j] < min ) {
min = array[i][j];

[Code] .....

View 4 Replies View Related

C :: Finding Minimum Values Of Two Decision Variables?

Sep 17, 2014

I am trying to solve a MIP problem using C with Cplex linker. I need to find min value of two decision variables, as far as i know, i should write as a constraint because they are decision variables. "if" statement does not work for decision variables. here is some part of my model in C.

Code:

void TSPMIP(int Scenario, int Agency)
{
int i,j;
double tmpDouble;

[Code]....

View 7 Replies View Related

C++ :: Finding Maximum Value In A Map

Jul 26, 2014

Suppose that a map is defined thus: map<sttring, int> mymap;

I wanna find k maximum values. Is there a way to find the maximum value in an efficient manner? Or else, How can I sort them and then find the k first elements?

View 1 Replies View Related

C++ :: Finding Maximum Value In A Vector

Nov 12, 2014

This is part of my main code that is giving me compiler issues.

//Find max value
max = max_element(vecTemperature.begin(), vecTemperature.end());

I keep getting an error saying "[Error] cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment"

View 2 Replies View Related

C++ :: Finding Maximum Of A Function

May 8, 2014

What is the syntax to find the maximum of a function over the interval a≤x≤b starting at a with a step size of Δx ?

View 1 Replies View Related

C/C++ :: Finding Whether Point Is Inside Polygon

Jul 17, 2012

I am trying to find out whether a point is inside a polygon.I am using vector std c++.

My program till now:

Polygon.h
class Polygon {
public:
Polygon();
virtual ~Polygon();
virtual bool Inside(Point p);

[Code] ....

I liked the ray casting algorithm but I dont know how to do in C++.

View 28 Replies View Related

C++ :: Finding Intersection Point Between A Plane And A Line

Mar 25, 2013

I'm following this example on finding the intersection point between a plane and a line. (it's about three quarters down) [URL] .....

However this seems to only show how to solve u.

1. I don't understand what u is.
2. How do I find out the intersection point, in terms of (x, y, z)?

View 4 Replies View Related

C/C++ :: Array To Only Print Out Final Average And Final Maximum Score With Final Minimum Score

Aug 27, 2014

#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];

[Code] ....

I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...

Minimum and maximum scores are displaying 0.0

And it displays these things 4 times in a row i just want it to be displayed once.

View 1 Replies View Related

C :: How To Change MPI Broadcast Into Asynchronous Point To Point Communication

Jun 26, 2013

I have one code that use MPI broadcast and I want to change it into Asynchronous Point to Point communication. I am newbie in Parallel programming. Looking for implementation of one simple same program in broadcast and P2P ?

View 6 Replies View Related

C++ :: Minimum Gap Between Two Primitives

Jan 11, 2014

if(rand() % 200 == 0)
{
switch(rand()%8)

[Code]....

How can i introduce a minimum gap sort of thing between these cases?

View 2 Replies View Related

C :: Find Minimum Value In Given Matrix M

Jun 16, 2013

The method doesn't work properly, the point of the code is to tell the minimum value in the given matrix "m", it's supposed to take the first value of the matrix store it in min_ and then compare it to every value of the matrix, if the value stored in min_ is bigger than the current value in the loop then it's stored as the new min_ and at the end it's supposed to print that minimum...

Code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 3
void minimum (int mat[SIZE][SIZE]){
int r,c;
int min_;
printf("

[Code] ......

View 5 Replies View Related

C++ :: Minimum Spanning Tree

Oct 18, 2014

Here is my code

//input:
4
0 -3 5 2
-3 0 1 0
5 1 0 1
2 0 1 0

#include<iostream>
#include<fstream>
#define fin "d:input.txt"
#define fon "d:output.txt"
using namespace std;
ifstream fi;
ofstream fo;
void OpenFileRead(){

[Code] .....

the result should be:
1-2
2-3
3-4
-1

but it is
1 - 2
2 - 3
2 - 4
-2

View 9 Replies View Related

C :: Determine Minimum Number Of Changes That Can Be Made

Mar 7, 2013

You are given an integer, perhaps a very long long integer, composed of only the digits 1 and/or 2. You have the ability to change a 1 digit into a 2 and a 2 digit into a 1 and must determine the min. number of changes that you can make resulting in no 2 digits remaining in the number that are in a position(in terms of powers of ten) higher than any 1 digit.

example:

2222212 number of changes:1
1111121 1
2211221 3
1122112 2

no negative numbers.

how to get started. Also I'm not allowed to use anything related to arrays or sorting.

View 6 Replies View Related

C :: Write A Code To Calculate Minimum Number

May 24, 2014

I'm trying to write a code to calculate the minimum number of coins needed to cover a change. It works fine but i want to display a message telling the user to try again if they type something that's not a number or a negative number. But it's not working. When i type a negative number, the program runs normally and displays a negative value of coins instead of showing the message. And when i type something that's not a number, the program just keeps showing a lot of zeros nonstop. And when i try to compile it with 'unsigned float' instead of just 'float' i get errors.

Code:

#include <stdio.h>
int main()
{
unsigned int coins;
float change;
unsigned int n25, n10, n5, n1;
unsigned int r25, r10, r5;
}

[code]....

View 7 Replies View Related

C++ :: Find Minimum Data Of Binary Tree?

Mar 24, 2013

I want a recursive function that returns a pointer pointing to the node which has the minimum data in the binary tree.

That's what I wrote:

struct CP {
int data; // data of the node
CP * left; // pointer to the left subtree
CP * right; // pointer to the right subtree

[Code]....

It can only find one side of the binary tree.

View 8 Replies View Related

C/C++ :: Find Minimum - Getting Median And Mode In Array

Feb 7, 2015

So I am trying to find the min, max, range, mean, median, and mode. The max number is right but the min isnt. Once that is corrected, i can get range and mean easily. Also, how to get mode and median. I am guessing the values in the arr2 would have to be sorted. This refers to the values in arr2 which are the calculated values in the formula. You can enter -2 and 2 for userMin and userMax.

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << fixed << setprecision(1);
float userMin;

[Code] .....

View 13 Replies View Related

C++ :: Create A Loop To Return Minimum Value Using Boolean Variable

Mar 20, 2013

I need to create a loop to return a minimum value using a boolean variable but don't quite understand how to format my algorithm.

#include <iostream>
using namespace std;
int main() {
bool first = true;
while (first) {
cout << "Enter a number (X to exit): ";
int num;

[Code]....

I know its jacked up any comments in the code would be great I need to finish the program but also understand it.

View 6 Replies View Related







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