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


ADVERTISEMENT

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++ :: 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/C++ :: Find Maximum Of Three Numbers Given By User?

Jan 25, 2014

I'm new to C++ and I'm trying to solve the question but there is just something wrong somewhere.

#include <iostream>  
using namespace std;  
int main() {
    int largest;
    int a;
    int b;
    int c;  
    cout<< "Enter first value";

[Code] ....

View 1 Replies View Related

C/C++ :: Write Program Which Find Maximum Among Four Numbers?

Aug 5, 2014

user enter four number and the output will be the greatestt number among these

View 1 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 :: 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 :: 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 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++ :: 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++ :: 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++ :: Find And Print Average Of Odd Numbers Greater Than 5 And Less Than 100

Nov 5, 2014

I am new to programming in C++, and have got a project on this.

Write a C++ program that accepts three numbers from the user (All are integers):

Such as:

Enter the first mark: 3
Enter the second mark: 25
Enter the third mark: 23

The program should find and print the average of the odd numbers greater than 5 and less than 100.

View 4 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++ :: 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 :: How To Print Only Maximum Value

Sep 20, 2013

I have this code that determines the amount of people that can fit on some trains in different train combination scenarios. Here is the code:

#include<stdio.h>
#include<stdlib.h>
int main(void) {
int total_track, max_train_length, num_people, num_trains, tl;

printf("What is the total length of track, in feet?

[Code] ....

I need to now "pick the winner," or the highest value for num_people computed. How would I go about this and why?

View 6 Replies View Related

C++ :: Boruvka's Algorithm - Find Minimum Spanning Tree Of A Graph

Apr 10, 2014

I am trying to implement Boruvka's algorithm to find the minimum spanning tree of a graph but my program crashes in the find function when i run it.

[URL] .....

sample input : [URL] .....

View 1 Replies View Related

C/C++ :: Find Minimum Difference Between Two Pairs Of Integers In A List / Array

Jan 18, 2015

I'm trying to write a simple program that finds the minimum difference between two pairs of integers in a list/array. Of no surprise, it not work the first time I ran it so naturally i chucked in a whole bunch of print statements to debug

I encountered a peculiar error that is really stumping me.

#include <iostream>
using namespace std;
int closest_pair(int arr[]) {
int i=0;
int j=0;
int size=0;
int min=0;

[Code] .....

OUTPUT:
size_main: 20
arr_main: 80
arr[0]_main: 4
size: 2
arr: 8
arr[0]: 4
0: 34
1: -12
2: 18
3: 61
19: 75
closest_pair: 0

I'm printing the size of the array in main and inside the function...and inside the function its giving me a size = 2 which is incorrect though the size printed in main is correct (size = 20). I further narrowed down the discrepancy to this statement: sizeof(arr)

View 2 Replies View Related

C++ :: What Is The Maximum Range Of Integer Array For Initialization

May 22, 2014

i have tried like that int arr[1000000] to initialize but it crashed my programm.but if i do int arr[100000] it works fine..why is that and what is the maximum range of integer array initialization??

View 5 Replies View Related

C :: Find The Maximum Subsequence Sum

Mar 12, 2014

I got a code written in Java. But, I gave up writing code in Java. The program written is supposed to find the maximum subsequence sum. It's originally like this.

Code:
private static int maxSumRec (int [] a, int left, int right)
{
if(left == right)
if(a[left > 0])
return arr[left];

[Code] .....

I turned it into C, add some elements (to generate random numbers and change some variables' names), and becomes like this

Code:
int maxSumRec (val, left, right)
{
int x;
long int arr[val];
srand ( time(NULL) );
for(x=0; x<val; x++)

[Code] .....

It fails to compile. What have I done wrong? And I keep wondering why in the original code there is left and right variables and their values are never assigned. My c compiler (I use codeblocks) keeps telling me that. Idk why. My friend who keeps it in Java says it is fine but he cannot explain how his program works. What *is* left and right actually?

View 8 Replies View Related

C :: How To Find Maximum Value Of Array

Oct 29, 2014

Any way to determine the highest value of an array I created with random numbers. I am confused because the array needs to be initialized in the main, but populated in a function. I was able to populate it using a pointer variable and my results came out good for the initial array values and elements.

In order to figure out the max, I think I would need the results of the populated array. How do I do this when the populated array is stored in a pointer variable? Would I need to create a pointer to the first pointer I created? I tried creating another pointer to the initial array and printing that, but my results were not good.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

[Code].....

View 10 Replies View Related

C :: How To Find Maximum Value For Middle Row Of Array Data

Aug 2, 2014

I was given some practice problems in my programming class, to prepare for the final and I don't quite understand what this one is asking for exactly:

Write the remainder of the program to find the maximum value for the middle row of the array data. Print the max after finding it. Your code should work for any 2D array of ints with three rows and four columns, so don't hard-code your program to these specific values.

Code:

#include <stdio.h>
int main(void)
{
int data[][4] = {{ 5, 8, 7, 2},
{ 3, 10, 1, 9},
{ 6, 12, 5, 0}};

View 8 Replies View Related

C :: Find The Maximum Value In A Column Of Text File

Jul 28, 2014

I have problem with finding the maximum value in a column. This is my code

Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen ("C:
ocket1.txt", "r");
float time, altitude, velocity, acceleration, amax, bmax;

[Code] ....

The first loop will print out all of numbers in the velocity column. The second while loop is looking for the maximum value in that column. It is supposed to print out the max velocity in the end of the second loop. However, when I build and run the program, it's crashed. I run debugger and received "Segmentation fault" error. When I eliminate the second loop, it run just fine I use Code::Block for text editor.

View 8 Replies View Related

C++ :: Creating Table Of Arrays - Find Maximum Value And Sum

Aug 12, 2014

I have an array of "2,3,4,5,6,9,10,11,12,99". I need to create a table of this which i have done using case

1. Find the maximum value of the array
2. Find the sum of the first and last element of the array
3. Swap the adjacent pairs of arrays
4. Display the values in array
5. Quit

Please enter choice:

but when i try running the program i did i keep having the break or continue pop up ....

#include <iostream>
using namespace std;
int main() {
int choice;
int number[10] = {2,3,4,5,6,9,10,11,12,99};

[Code] .....

View 6 Replies View Related

C/C++ :: Program To Read Sequence Of N Integers And Print Number With Maximum Occurrence

Mar 24, 2014

write a program in c to read a sequence of N integers and print the number that appears the maximum number of times in the sequence.

View 1 Replies View Related

C++ :: Maximum Numbers Of Elements That Can Be Eliminated From A Set Of Sets?

Nov 17, 2014

I have come across a problem lately. You are given a set of n sets with m variables.. for instance {a,b,c,d}, {b,c,d}, {b,c}, {c,e,f}, {e,f}. And you want to eliminate elements from these sets with the restriction that you can only eliminate one item from each set and each item can only be eliminated from one set (i.e. if you've eliminated b from set {a,b,c,d}, then you cannot eliminate it from {b,c,d}). The problem is writing an algorithm which determines the maximum number of elements you can eliminate. And I'm hopelessly stuck... of course, you could backtrack it and determine this number but I feel it could be done more efficiently..

View 2 Replies View Related







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