C# :: Histogram - Identify Integer In Array And Insert Symbol For Every Single One

Apr 18, 2015

I am supposed to make a histogram. I succeeded in generating the integers for the histogram. But what I want to do is instead of displaying numbers in the console, I want something like "*" displayed for every integer there is in an array. It should look something like this.

*
****
*****
********
**********
******
****
***
*

As far as I understand, in some way I need to identify the integer in the array and for every single one of them I need to insert the symbol. I don't know how to identify it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1{
class Program {
static void Main(string[] args) {
diceHistogram();

[Code] .....

View 2 Replies


ADVERTISEMENT

C++ :: How To Manipulate A Whole Array As A Single Integer

Mar 22, 2014

here i have an assignment, creating a longInt class and using it to calculate large numbers, i dont have a clue how to manipulate a whole array as a single ineteger.

View 7 Replies View Related

C++ :: How To Convert Large Valuge Form Single Integer To Array

Jun 3, 2013

i have mathematic operation and the result is near 70 digits....single variable cannot hold it....

View 4 Replies View Related

C :: Identify The Invalid Expression - All Variables Are Integer And Nonzero

Feb 20, 2015

Identify the invalid C expression or choose "all are valid". Assume all variables are integer and non-zero.

7.
a) a+b-0 b) c+-a%4 c) xm6-24 d) xf3r6+2
e) all are valid

8.
a) xx+yy%zz b) z%(z%z%z)) c) ha+ha+ha d) x23-20.4
e) all are valid

[Code] ......

View 10 Replies View Related

C++ :: Insert Variable For Size Of Array And Prompt User To Insert Elements

Dec 1, 2013

how to insert a variable for the size of array and prompt user to insert the elements for the array?

View 13 Replies View Related

C++ :: Create Single Integer Number From Four Integers

Mar 1, 2014

Write a program that reads four integers from a file ‘input.txt’.

The program will then create a single integer number from the four integers. The output of the program will be the single number and single number + 600.

#include <iostream>
using namespace std;
int main () {
int number , a;
cout<<"enter en integer number";
cin>>number;
cout<<"add 600 to the number"
cin>>a=number+600;
return 0;
}

View 5 Replies View Related

C++ :: Program To Convert Int To Char Array Without Symbol

Apr 17, 2014

I'm writting program and need to convert int ot char array without simbol. I have tryed snprintf , but his returns array full of simbols if it is initilized elsware return full of garbidge. Is there any elegent way to aceave this? What I'm trying to aceave is liek this:

char buffer[10];
int temp = 1231423;
// Do conversation...
// After conversation char array should look like this
// 1 2 3 1 4 2 3 _ _ _
// without simbol

View 2 Replies View Related

C++ :: Multidimensional Array - Moving Whole Int Array Row As A Single Unit?

Feb 27, 2013

I have a multidimensional array that runs parallel with a string array

Lincoln 120 300 400
Parks 100 500 250
Shakespeare 0 30 50
Ghandi 250 100 40
Ashe 300 50 175
Rodriguez 87 118 320
Curie 284 0 112

I need to sort this and I know how to do it. But I need to sort it again with the highest value in the first row and keep all information in that row paired with the name . So

Lincoln 120 300 400
Parks 100 500 250

Parks 100 500 250
Lincoln 120 300 400

I need so swap this whole rows. I'm using dynamic array. So my question is Do I have to do a bunch of temps to move them? Or is there a way to move the whole int array row as a single unit?

View 3 Replies View Related

C :: Assign Integer Value To Unsigned Char Array But It Is Not Storing Integer Values

Oct 25, 2013

I am trying to assign the integer value to unsigned char array. But it is not storing the integer values. It prints the ascii values. Here the code snippet

Code: uchar uc[100];
for(i=0;i<100;i++)
{
uc[i] = i;
}

The values which are stored in uc[] is ascii values.I need the integer values to be stored in uc[]. I tried to do it with sprintf. but the output is not as expected. if I print the uc[i] it should diplay the value as 0,1,2....99.

View 9 Replies View Related

C :: Simple Search - Any Single Numbers In Array

Jul 13, 2013

I wrote a code which checks if there are any single numbers in an array.e.g.In the next array there is a single number - "3" 4 1 4 3 4 1..Here is an array which doesn't have single numbers in it: 4 1 4 3 3 1

Code:
#include <iostream>
using namespace std;
int single (int arr[], int size)
{
int couple=0;

[Code]....

First I thought to double the number of couples I'll get from my search and find some connection to the length of the array, but it hasn't worked out (signed red).

View 9 Replies View Related

C++ :: How To Insert Array Size As Variable

Nov 30, 2013

How do I insert a array size as variable?

View 5 Replies View Related

C++ :: Identify Floating Or Alphabets

Apr 28, 2013

I have this homework where i am implementing a code which does error checking

so basically i have 3 variables and i assigned them as integer. so my error check is asking that if i type a value for instance 1.2 it should output "X"...

View 19 Replies View Related

C/C++ :: Have To Identify Odd Number And Print Them

Apr 10, 2013

#include<stdio.h>
#define TRUE 1  
int formOddInt(int n);  

[Code]....

View 5 Replies View Related

C++ :: How To Insert Strings Into Array Of Type Char

Sep 2, 2013

How to insert strings into an array of type char and also delete strings from that char array.

View 4 Replies View Related

C++ :: Reading Two Words Into Single Char Array From Text File

Sep 15, 2014

I am trying to read in player names (ex: first last) from a text file into the people[].name data struct. I can successfully read in my card file, but I cannot get this to work. I get a seg fault. I believe this is because nothing is actually being read in for my while loops. I can't use std::strings so these must be c-style strings aka char arrays.

// deck of cards
// below are initializations
#include <iostream>
#include <fstream>
#include <ctime>
#include <stdlib.h>
#include <string>

using namespace std;
//globals
const int maxCards = 52;

[Code] .....

View 1 Replies View Related

C++ :: Compare Element Of Char Array And String With Single Character

Dec 3, 2014

how can i compare an element of the char array and string with single chsracter also how to compare char array to cpp string

View 3 Replies View Related

C++ :: Identify Polynomial With Two Arrays Of Same Length

Oct 15, 2014

I wanna write a class for polynomials, but there are some bugs in my code. I want to identify a polynomial with two arrays of the same length, one that contains the exponents of the nonzero monomials, and the other that contains the coefficients itself.

for example: (shematically)
3x^2 +5x^100 shoud be identified by array1=(2,100) and array2=(3,5)

the size of that polynomial should be Dim=2.

it should be possible to change the size dynamically.

Code:

#ifndef poly
#define poly
#include<cassert>
class poly {

[Code] ....

PROBLEM1 the destructor isnt working:
virtual ~poly() {delete [] start;delete [] koef;} //destruktor
Error: This declaration has no Storage class or typ specifier.
Error: Expected an identifier.

PROBLEM2 the constructor isnt working:
poly::poly(int x=0)
Error: Expected an identifier
Error: Expected a )
Error: Expected a ;.

I dont know what the computer want to tell me??

View 6 Replies View Related

C++ :: Identify End Of Function Code At Running Time

Apr 16, 2013

I want to implement some "debugger like" tool (very limited one, just identify at running time the current stack trace, and print messages from the user) on some code that the user wrote. what I get from the user is a function name (in the beginning of it's declaration), and when the user want to print some message he uses some print macro I should implement.

My target is printing the stack call, and all the messages that the user wrote, in the right place on the running place.

By what c++ feature can know on running time that a specific function code has ended??

Its easy to push a function to some vector when it called (since I get its name from the user), but when it ends and return to the function called it...

View 14 Replies View Related

C++ :: Identify Correct Function Pointer From Vtable?

Jan 21, 2013

We know that function pointer for virtual function are stored in a vtable.When we have multiple function pointer entry in vtable and we call one of the virtual function then how the corresponding or correct function pointer is retrived from Vtable? Who do this stuff? In assembly code i can not see any code or logic to detrmine the correct function pointer.

View 4 Replies View Related

Visual C++ :: Identify Which Of Two Subclassed Controls The Mouse Is Over?

Feb 11, 2013

I have a dialog app with two separate static controls. Both controls have been subclassed from CStatic derived class to implement drag and drop and double clicking. The class works just fine, but I cannot figure out which of the controls is being double clicked or dragged and dropped onto because I only have the code below operating. I need some method in the derived class to determine which control is being manipulated.

Code:
// header file
#pragma once
#ifndef __AFXWIN_H__

[Code]....

View 3 Replies View Related

C :: Borders Around Histogram

Mar 6, 2015

I'm able to get the graph, but now getting the border on the other side of the graph to align it with the right side of my screen.The output looks like that right now because I'm currently playing around with my y axis (right under the for loop) trying to scale everything. I've tried everything many different ways to get this to work.getting the border on the other side of the graph.

Code:

#include<stdio.h>
#include<Windows.h>
int main(void) {
int MAX = 0; //initialize and declare variables
int allcounts [10] = {0}; //store an array of integers for
}

[code]...

View 4 Replies View Related

Visual C++ :: Histogram With Bin Size 5

Mar 15, 2013

I have following code to create histogram, but it gave wrong output. In the program input_vector read 100 double numbers. I want to create a histogram with bin size=5. Output is [0;0;0;0;0].

Code:
vector<double>three_dimensional_shape_retreival_Hough_Transform:: histogram_creation(vector<double> input_vector) {

long int i;
long int j;

Mat histogram_input(input_vector);
cout<<"Histogram Input Matrix:"<<histogram_input<<endl;
int histSize =5;

[Code] .....

View 4 Replies View Related

C++ :: Accept Integer Array And Its Size As Arguments And Assign Elements Into 2 Dimensional Array

Jan 10, 2015

Write a program using user-defined function which accepts an integer array and its size as arguments and assign the elements into a two dimensional array of integers in the following format: If the array is 1,2,3,4,5,6, the resultant 2D array is

1 2 3 4 5 6
1 2 3 4 5 0
1 2 3 4 0 0
1 2 3 0 0 0
1 2 0 0 0 0
1 0 0 0 0 0

View 1 Replies View Related

C :: Printing Histogram About Number Frequencies?

Mar 6, 2015

have this program .. i tried to make it work to give me this result output:

Code:
input array {1,3,5,1,1,8,6,6,1,3,2,1,6,8,8}
[0]
[1] *****
[2]*

[Code].....

instead i'm having asterisks at the end of the output

View 14 Replies View Related

C :: Implementation Of Histogram Using Functions And Arrays

Apr 12, 2013

I'm trying to code one of the problems but it really is hard to catch errors for a novice like me at first.

I have to Write a single C function for computing the histogram of a list of nonnegative integers into 4 bins.

The main() function first initializes a positive integer array called List of size N, takes 3 inputs from the user A, B, C (assume 0 < A < B < C), and declares a second integer array Bin[4].

The doBinning function should count the number of elements of List in the interval [0, A) and store it in Bin[0], count of [A, B) in Bin[1], count of elements in [B,C) in Bin[2], and the number of elements >= C in Bin[3]

Code:
#include <stdio.h>
#define N 10
#define M 4
int *doBinning (int source[], int dest[], int a, int b, int c);
int main (){

[Code] ....

Somehow I keep getting error from ptr = doBinning(List[], Bins[]. What am I doing wrong? Code might contain some errors.

View 3 Replies View Related

C :: Generating Histogram Of PGM Format Image

Jul 29, 2014

I need a C code for generating a Histogram with intensities at X-axis and number of pixels at Y-axis from a PGM format image.

View 5 Replies View Related







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