C++ :: Display Average Of 100 Values?

May 21, 2013

Howe can i display the average of 100 values in c++ 2008....

View 4 Replies


ADVERTISEMENT

C :: Print Correct Normalized Value / Average And Values Above Average

Nov 14, 2013

I must write a function that has a one dimensional double array and the number of values in the array as its arguments. Normalize the values. I must also print the maximum, minimum, average and numbers of values above the average in the array.

The equation that computes the normalized value from a value x is:

Normalized x= (x-min(array))/(max(array)-min(array))

My code does not print the correct normalized value, average and values above average.

Code:
#include <stdio.h>
int findMax( double array1[], int num_elements) // This function computes the maximum value of the array
{
int i, max=-32000;
for (i=0; i<num_elements; i++)

[Code] .....

View 5 Replies View Related

C++ :: Read Unknown Number Of Integer Values And Then Print Count Sum And Average Of Odd Values

Apr 9, 2014

write a c++ program that reads an unknown number of integer values and then print count, sum and average of odd values, even values, positive values, negative values!!

View 1 Replies View Related

C :: Function To Display Students Who Are Above And Below Average

Oct 30, 2013

Code:
#include<stdio.h>
int calcAbvAvg(int marks[10], int avg) {
int students = 0;
int i;
for(i=0;i<10;i++)

[Code] .....

I suck at function and linked list. The only problem i am having in this question is the function calcAbvAbg() not working! I want that function to display the students who are above and below average!

View 4 Replies View Related

C# :: Display Average Value Of Pixels In The Image

Feb 4, 2013

I have a project which opens an image in PictureBox1, no problem. But the Public Static Color method at the bottom of the code is not working. I was hoping it would display the average value of the pixels in the image. why it is not working?

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Imaging;
using System.Drawing;

[Code]...

View 2 Replies View Related

C++ :: Average Rating Does Not Display Correctly?

Oct 25, 2013

My program for school works properly, but I cannot seem get the average to compute properly.

#include < iostream >
#include < iomanip >
#include < array >
#include < string >

[Code]....

View 4 Replies View Related

C/C++ :: Display Average GPA Of Some Students In A File

Nov 29, 2014

I have learnt about string class, file I/O and pointers. Now I am asked to write a program that includes the above topics, basically testing the ability to use dynamic arrays.

I've got 2 documents, namely "Students.txt" and "EnrollRecords.txt". "Students.txt" includes 40 students' info, which are university ID, programme names and their names. These 40 students are all BEng but from different departments.

E.g. 20141129 BEng(Civil) Tom Jerry

"EnrollRecords.txt" includes 166 data, which are course codes, university ID, respective scores in the test and GPA. In this document, the same student can have several scores of different courses' tests. So their uids repeat in it. And this document only contains the data of the Department of Computer Science. So students exist in the "Students.txt" may not exist in this document.

So my task is that the user enter a name (e.g. John), then the programme will know to find John and his uid, and get all the GPA of the courses that he has taken to calculate the average GPA.

E.g. 20147777 BEng(CompSc) John David //this is a John we are looking for in the "Students.txt"

//line 15 COMP1220 20147777 90 4 //so we find 3 courses in "ErollRecords.txt" that John has taken
//line 50 COMP1500 20147777 85 3.3
//line 88 ENGG2012 2014777 70 2.3

The programme should display :

20147777 3.2

To able to do anything for this task, I am asked to define 4 struct types:

struct Student {
int uid;
string programme;
string name;

[Code] ....

So now I am going to write a function queryD(Database d, string searchName) and any necessary functions in it. I am able to do the search part,

void queryD(Database d, string searchName) {
for (int i = 0; i < d.numberOfStudents; i++) {
if (d.students[i].name.substr(0, searchName.length()) == searchName) {
match_uid(d);

[Code] ....

But I struggle in how to match the uid in "Students.txt" and "EnrollRecords.txt" . Because there are repeated data for the same student in "ErollRecords.txt". So how am I gonna be able to match the uid and do the calculation? I get stuck in the for loop part...

View 1 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# :: Calculating Averages - Display Employee Number And Average Of Three Test Grades

May 3, 2015

I have a project that I am working on and I have gotten stuck. I am getting a couple errors and would like to see how I can complete the program. Not very long of a program at that. My instructions are:

Write a program to calculate averages. Create a method named ReadData that will load a two dimensional array, named scoresArray, with the following data from a file:

132475.889.392.3
435686.383.498.3
479090.177.376.9
839373.976.389.3
556397.378.478.9
832987.365.377.2
271767.989.379.3

ReadData will have one argument, the scoresArray.

Create a method named DisplayAverages that will display the emplyee number (number starting 1324, 4356 etc) and the average of the three test grades. DisplayAverages will have one argument, the scoresArray. Your output should closely resemble the following.

Student #Test1Test2Test3Average
132475.889.392.385.8
etc, etc

Round averages to one decimal place. Passing arguments is important for this program. No global variables are allowed, except for the streamReader and the streamWriter. The scoresArray must be declared in Main and passed as an argument to the methods ReadData and DisplayAverages.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LibUtil;
using System.IO;
using System.Text.RegularExpressions;

[Code] ....

When I run the following just to see where I am getting I get the following error:

UsersJoeDocumentsVisual Studio 2013ProjectsCIS110Program12Program12Prog
ram12Dat.txt was opened
Unhandled Exception: System.IndexOutOfRangeException: Index was outside the boun
ds of the array.
at Program12.Program.ReadData(Double[,] scoresArray) in c:UsersJoeDocument
sVisual Studio 2013ProjectsCIS110Program12Program12Program.cs:line 66
at Program12.Program.Main() in c:UsersJoeDocumentsVisual Studio 2013Proj
ectsCIS110Program12Program12Program.cs:line 24
Press any key to continue . . .

What am I missing here? I believe I have passed the arguments properly, but I am unable to declair the array within the bounds of the array?

View 2 Replies View Related

C++ :: Calculate Average From Array Values

Jan 8, 2014

i wrote following code to calculate average of the values entered to the array.After displaying the output following error was displayed.

"Run-Time Check Failure #2 - Stack around the variable 'marks' was corrupted.

A buffer overrun has occurred in q 3 410005111.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. "

//Average mark of student 1
cout<<"Avarage mark of the student 1 :"<<(marks[0][0]+marks[1][0]+marks[2][0]+marks[3][0]);
cout<<endl;

View 5 Replies View Related

C/C++ :: How To Find Average Of Three Groups Of Values

Aug 14, 2014

how to compute the averages for 6 values that have been computed from a for loop,

I mean once the for loop finishes it prints me six different values classified into 3 groups as shown down:

group1 has value1
groupe2 has value2, value3, value3
group3 has value5, value6

I want to find the average for each group.

considering the number of values in each group might change. this is the code for finding the values:

for (int i=0; i<n; i++)
{
if (value < 25)
{

[Code]....

View 5 Replies View Related

C++ :: Pointers And Arrays - Program To Display Sorted List And Average Of Scores With Appropriate Headings

Apr 22, 2014

I am writing a class that dynamically allocates an array that holds a user-defined number of test scores (test scores go from 0 to 10 both included). Once all the test scores are entered and validated (values only between 0 and 10, both included), the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates theaverage of all the scores.The main program should display the sorted list of scores and the average of the scores with appropriate headings.

View 6 Replies View Related

C :: Find Smallest / Largest And Average Values In A Collection Of N Numbers

May 30, 2014

I seem to have reached a dead end in a program I am attempting to write.The purpose of the program is find the smallest, largest, and average values in a collection of N numbers. It needs to get the value of N before scanning each value in the collection of N numbers.I'm having trouble creating comparisons for each set. I have a feeling because of the way I structured my program, I'm unable to make a proper comparison. Maybe my approach was wrong as soon as I got to the for statement to loop N sets and N numbers.Here is my code so far:

Code:

#include <stdio.h>
int main (void)
{
int num_sets, num_of_integers;
int count, count2, set, sum = 0;
int num, avg;
}

[code]....

/* Here is where I would continue to attempt to make a comparison between sets to determine smallest to largest */

return 0;

View 5 Replies View Related

C++ :: Using A For Loop To Input And Output Array Values Also Calculate The Average

Jan 24, 2014

I have this code that im stuck on what i need to do is Extend the code such that when it starts the user is asked to input values to specify each of the three ranges before moving on to accept and tally the main values how do i do that Using a for loop to input and output array values Also calculate the average

*/
#include <stdio.h>
int main(void)
{
/* Declare an array of integers */
int Grades[5];
int nCount;
int nTotal = 0; /* Declare and initialise the value */
float fAverage;

[Code]...

View 1 Replies View Related

C++ :: How To Display Inputted Values

May 10, 2013

Program works perfectly fine. I input in the length, width and height. But i want it to display those values for every individual prism when i output... along with the area and volume which i already have. Since i made a vector i won't let me cout it normally.

#include <iostream>
#include <vector>
using namespace std;

[Code].....

View 2 Replies View Related

C :: Pointer To Display Values Of Array

Feb 12, 2013

I am using pointer to display values of an array but its output is not correct example 23424,0, -323423 etc... whats the problem with my code:

Code:
#include<stdio.h>
#include<conio.h>
int main() {
clrscr();

int arr[10][10],rows,cols;
int* ptr;

[Code] ....

View 4 Replies View Related

C# :: Display Different Values From Array Into Textbox?

Jul 28, 2014

I need to display values from my array that I get from my textbox 1 into my textbox 2 with the following format:

char[0] "whatever" char[2]
void Button1Click(object sender, EventArgs e) {
string text = BIRTH_DAYW2.Text;
string [] split = text.Split(new char[] {'/'});
for(int i = 0; i < split.Length; i++)

[Code] ....

View 2 Replies View Related

C :: Get Code To Display A Table With Values From A File

Feb 20, 2015

get my code to display a table with values from a file. my current code fills up all the sections of the table with the same data. here is what I need: from a file .txt I upload numbers that should show a table like this :

Lake Beach Average E-Coli Level
Recommendation
Ontario Kew Beach 47.12 OPEN Huron Goderich 51.13 CLOSED Simcoe Sibbald Point 0 INSUFFICIENT

my problem is in the last two columns. The ave. E-coli has one value for all which should look like the above table but my code doesn't. Also my recommendation shows the beach # instead of open close or insufficient.the data is:

Lake table
1: Ontario
2: Erie
3: Huron
4: Muskoka
5: Simcoe

Beach table
100: Kew Beach
101: Sunnyside Beach
103: Sandbanks
201: Port Dover
202: Port Burwell
203: Crystal Beach
301: Goderich
302: Sauble Beach
303: Kincardine
401: Muskoka Beach
501: Sibbald Point
the .txt file contains the following data:
1 101 5 66.6 33.3 22.2 98.9 11.1
5 501 2 33.3 44.3

now this is my code:

Code:

#include <stdio.h>
#include <math.h>
int main(void)
{
FILE *in;
}

[code]......

fix the two last columns so the correct info shows like the table above.

View 3 Replies View Related

Visual C++ :: Display Values Of 2-dimensional Array

Aug 31, 2013

1.Create one 2-dimensional array. The array will consist of numbers from 1 to 10. And will also contain the number in words. Display the values of the 2-dimensional array.

Sample output:
1 - One
2 - Two
3 - Three

Paste the program code here:

2.Create a program that will accept two integer numbers. These integer numbers will be the limit of the multiplication table. Store the values in a two dimensional array.

Sample output:
Enter x: 3
Enter y: 2
123
246

Paste the program code here:

3. Determine the output produced by the following program segment.

int ROWS = 3;
int COLS = 4;
int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}};
for (int i=0; i < ROWS; i++) {
for (int j= 0; j<COLS; j++)
System.out.print (val [i][j] + " " );
System.out.println ();
}

Write the Output:

View 6 Replies View Related

C/C++ :: Display Inputted Values Without Overwriting Other Inputted Values

Jun 16, 2014

How can I display my inputted values here without overwriting the other earlier inputted values. It should be displayed like this [URL].... but mine shows this [URL].... I've been stucked here for hours in thinking for an algorithm. Everything is working fine except the PDISPLAY part

#include<iostream>
#include<iostream>
#include<string>
#include<cctype>
#include<cstdlib>
#include <iomanip>
#include <windows.h>
#include<conio.h>

[Code]...

View 1 Replies View Related

C++ :: Trace Function - How To Display Actual Values In Console

May 24, 2014

Code:
Real x = (arg.state.X.abs - mViewport->getActualLeft())/float(mViewport->getActualWidth());
Real y = (arg.state.Y.abs - mViewport->getActualTop())/float(mViewport->getActualHeight());
_trace("%f %f
", x,y);

Code:
#include <Windows.h>
#ifdef _DEBUG
bool _trace(TCHAR *format, ...) {
TCHAR buffer[1000];

[Code] .....

Results:
f f
f f
f f
f f

How to display the actual values in the console?

View 4 Replies View Related

C++ :: Average Negative / Positive Numbers And Total Average?

Nov 18, 2013

I am trying to average the negative numbers and positive number and of course the total average.

This will read in a list of n values, where n is not known ahead of time. The number of values read into the array will be saved in n.

vector<int> readList() {
std::vector<int> result;
ifstream inFile;
inFile.open("setA.txt");
for (int x; inFile >> x; ) {
result.push_back(x);

[code]....

array is a one-dimensional array of integers and n is the number of elements in that array that contain valid data values. Both of these are input parameters to the function. The function must calculate 1) the average of the n integers in array, storing the result in ave; 2) the average of the positive numbers (> 0), storing the result in avePos, and 3) the average of the negative numbers (< 0), storing the result in aveNeg.

void avgs (std::vector &array, int &ave, int &avePos, int &aveNeg) {
int sum = 0, pos_sum = 0, neg_sum = 0, pos_count = 0, neg_count = 0;
for (auto i : array) {
sum += i;
if (i > 0) { pos_sum += i; ++pos_count; }

[code]....

View 1 Replies View Related

Visual C++ :: Program To Display Values From Data File As Image?

Jul 29, 2014

I am writing a program to display values from a data file as an image. But I can only get a blue screen. Here is a small program resembling my code. what I have missed? I only changed OnDraw function.

Code:
void CColorDisplayView::OnDraw(CDC* pDC) {
CColorDisplayDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CRect rect;

[code].....

View 10 Replies View Related

C :: Display Current Time And Date In Program And Use Variable To Store Each Of Values

Feb 16, 2013

i need to display the current time and date in my program and use variable to store each of the time values like

a = 10
b = 29
c = 31

printf(``%d : %d : %d``, a,b,c);

which then give the output as - 10:29:31

How to save the time in variables in C....

i am using C in windows 7 and my complier is Bloodshed Dev C++

View 7 Replies View Related

C Sharp :: Cancellation Of Duplicate Values - Display Match Items In ListView

Feb 4, 2013

How to display the record that match for the duplicate items in a Listview. I use C# with linq queries.

View 1 Replies View Related

C/C++ :: Call To String Function To Display Names In Class Not Display

Apr 19, 2014

I created class called students which suppose to store students names of in array but when I call the display function it display only the first name. but I want it to display names depending on the array size.

#include <iostream>
#include <sstream>
using namespace std;
const int SIZE=5;

[Code]....

View 3 Replies View Related







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