C/C++ :: Count The Times A Shape Was Selected?

Jul 28, 2014

This is part of the program, What should i do if i want to total the number of times a shape was selected at the end?

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

[Code]....

View 3 Replies


ADVERTISEMENT

C :: For Every Char Of Given Alphabet - Count How Many Times In The String

Feb 1, 2013

Be given a string of chars, where each single char belongs to the following alphabet: a..zA..Z0..9 (So, in the string there are only lowercases, uppercases and digits. No blank, no comma, ...).

For every char of the given alphabet, count how many times in the string

1----- the char is preceded by its predecessor in the alphabet (consider that the predecessor of 'a' is '9')
2----- the char is followed by its successor in the alphabet (consider that the successor of '9' is 'a')
3----- the char belong to a sequence of identical chars whose length is at least three (i.e.: in the string cc74uyrpfccc348fhsjcccc3848djccccc484jd for three times the character 'c' satisfies this condition)
4----- what is the longest substring of characters strictly rising (the following is greater (>) of the previous)
5----- what is the longest substring of successive characters (i.e.: fhkjshdfruytyzABCDEfglsj => 7)
6----- the frequencies of any char (if in the string the character 'g' occurs 12 times, its frequency is 12)

View 5 Replies View Related

C :: Count Characters In A File And Define How Many Times Each One Occurs

Feb 16, 2013

My problem is to count the characters in a file and define how many times each one occurs.Characters who are not found must not be included in the table; The output must be a table - like that -

”| character | ASCII- DEC | ASCI – HEX | how many times it occurs |”

This my function:

Code:
int f2(FILE *p1)
{
FILE *g3;
int char_count[256]={0};
char ch;
int n=0;
if(!(g3=fopen("D:zz.txt", "w"))){

[Code] ....

It must look like this:
| D | 68 | 44 | 2 |
| 2 | 50 | 32 | 1 | and so on...

View 1 Replies View Related

C++ :: Count How Many Times Each Word Appears - Empty Output Array File

Sep 20, 2014

I am writing this program that is supposed to read a file, put the data into an array, alphabetize, count how many times each word appears and print to an output function. I posted before on how my program had an error when I ran it but I have fixed that. Now my outputArray file is empty. It gets created but there's nothing in it.

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>

using namespace std;
//global to this file

[Code] .....

View 3 Replies View Related

C++ :: Search For A Number When Vector Is In Order - Count How Many Times That Number Appears

Feb 6, 2014

In this program what i'm doing is to search for a number when the vector is in order, and count how many times that number appears, the problem is that count how many times the number does not appear, but when its appear the program stays in an "standby mode" and the cursor does not move.

int buscarNumOrdenado (int x [MAX]) //MAX is the define {
int num,d, LimiteInferior, LimiteSuperior,mitad;
d=0;
LimiteInferior = 0;
LimiteSuperior = MAX-1;

[Code] ....

View 2 Replies View Related

C++ :: Random Number Generator - Count How Many Times Each Number Shows Up

Sep 26, 2012

I'm running a game online and designing a program to generate Enemy Stats. Basically, it's supposed to generate 25 numbers between 0 and 7(to represent 8 Attributes on a 25 Point Buy system) and count how many times each number shows up.

Here's what the code looks like:

Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int Generate() {
int r= rand();
int s= r%7;
[Code] ....

And here's two outputs.

1: Code:

12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 12133089220 Stats[0]= 25 Stats[1]= 0 Stats[2]= 0 Stats[3]= 0 Stats[4]= 0 Stats[5]= 0 Stats[6]= 0 Stats[7]= 0 Stats[8]= 0 Disallowed system call: SYS_socketcall

2: Code:

14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 14787708434 Stats[0]= 0 Stats[1]= 0 Stats[2]= 0 Stats[3]= 0 Stats[4]= 25 Stats[5]= 0 Stats[6]= 0 Stats[7]= 0 Stats[8]= 0 Disallowed system call: SYS_socketcall

Note that the number does change, but only between runs.

View 3 Replies View Related

C Sharp :: Retrieve Records Between Dates Selected From Datetimepicker And Of Selected Date

Mar 4, 2013

I want to retrieve the records selected between from_dt and to_dt and also the records of the selected date should be retrieved...

SELECT ChallanDtl.chalID, ChallanDtl.chalTo, 
ChallanDtl.chalNo, ChallanDtl.chalDDate,
ChallanDtl.chalYourNo, ChallanDtl.chalPO_NO, 
ChallanDtl.chalPO_Date, 
ChallanSubDtl.chalsubdescription, 

[Code] ...

I am not getting all the records.... when i select the same date in both datetimepicker no record is displayed... i also want the record of the selected dates from both datetime picker..

View 2 Replies View Related

Visual C++ :: Program That Count From 1 To 12 And Print Count And Its Square For Each Count

Dec 16, 2014

4.1 Write a program that will count from 1 to 12 and print the count, and its square, for each count.

4.2 Write a program that counts from 1 to 12 and prints the count and its inversion to 5 decimal places for each count. This will require a floating point number.

4.3 Write a program that will count from 1 to 100 and print only those values between 32 and 39, one to a line. Use the incrementing operator for this program.

View 2 Replies View Related

C :: How To Print Another Shape Near Previous One

Nov 9, 2014

How do i print another shape near the one i did. I have this code but how i can put another shape near it like this

Code:
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 5; i++)
switch (i) {
case 0:
printf(" *

[Code] .....

View 7 Replies View Related

C# :: Custom Button Shape (WPF)

Nov 30, 2014

I have begun switching from WinForms to WPF and I'm having a hard time understanding the new concepts. In WinForms, I had a few User Controls, custom drawn using shapes (rectangles, ellipses, etc). They had some unique properties, like "Flashing" (setting this property to True and setting the "Flash Interval" property to 500 would have resulted in the control changing its background color to white and back again, every 0.5 seconds), "Beeping", etc.

I have tried to replicate these controls in WPF/XAML and so far managed to draw the shape. However, when it came to implementing a custom property that would redraw the background color of the rectangle every interval set by user in another property, i got stuck. The property is being set, but it doesn't change the background color. Alternatively, i have tried this method, with the same results (i got it to show in the "Properties" window in Visual Studio, i can set it, it is being stored in XAML, but it doesn't affect the background.

C# code behind:
public struct LCARSColors
{
public static Brush DarkBlue = (Brush)(new BrushConverter().ConvertFrom("#FF3366CC"));
public static Brush LightBlue = (Brush)(new BrushConverter().ConvertFrom("#FF99CCFF"));
public static Brush Pink = (Brush)(new BrushConverter().ConvertFrom("#FFCC99CC"));

[Code] ....

If i use this line (commented in this code sample):

<!--<SolidColorBrush x:Name="MySolidColorBrush" Color="{DynamicResource DarkBlue}" />-->

The background is colored in DarkBlue (as defined). But if i use this line:

<SolidColorBrush x:Name="MySolidColorBrush" Color="{Binding BackgroundColor, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

Nothing happens, the rectangle disappears entirely. If i add this to the above line:

FallbackValue=LightYellow

The rectangle is colored in LightYellow, meaning that the property is not accepted and the fallback value is used. Why?

View 9 Replies View Related

C :: Drawing A Shape (Square) Into PGM Image

Nov 22, 2013

I'm doing a project and I need to draw a square into a pgm image if certain conditions are met, but I'm not sure how to draw the square into the image.

View 2 Replies View Related

C++ :: Generic Shape Area Calculator

Dec 6, 2013

I'm building a pretty basic calculator program that calculates the area of generic shapes (triangles, rectangles, and squares); for some reason though, my program is having troubles as soon as it hits the if/else code in the int main section. When I enter triangle, rectangle, or square, it just spits back out the "That's not one of the options. Please re-enter and try again." error line I created. When I isolate and run just the stuff inside the if/else statements it works great, but why it won't just understand my if (shape == triangle).... .

Code:

#include <iostream>
using namespace std;
class figure {
protected:
double x, y;

[Code] ....

View 2 Replies View Related

C++ :: How To Make A Shape Outside Of Main Function

Sep 8, 2014

I know how to define a shape and attach it to a window as follows:

#include <Simple_window.h>
void cir() { Circle c(Point(100,100),50); }
int main() {
Simple_window win(Point(100,100),600,400, "test");

Rectangle r(Point(100,100),Point(300,200));
win.attach(r);
win.wait_for_botton();
}

But how to define a shape (say a circle by that cir() function which is) outside of the main() function? And how to attach it to be visible on window win?

View 4 Replies View Related

C++ :: Use Construct Object (Shape) Efficiently?

Jun 27, 2014

have a problem with my code (I wish for answer with code). The conditions I have to grant:

- **Only** a pointer to an object must be saved in a **standard** class vector (e.g vector<ShapePtr>)
- Base class must be a polymorphic class (I call this class ShapePtr)
- I **must** have a deep copy process
- Constructor is **not** suppose to do a deep copy
- **clone()** is suppose to do the deep copy

Here is the code **provided** to me:

main.cpp
int main() {
typedef shared_ptr<Shape> ShapePtr;
vector<ShapePtr> shapevec;

[Code].....

View 1 Replies View Related

C/C++ :: How To Make A Shape Outside Of Main Function

Sep 8, 2014

I know how to define a shape (here, a rectangle) and attach it to a window in C++ as follows:

#include <Simple_window.h>
void cir() { Circle c(Point(100,100),50); }
int main() {
Simple_window win(Point(100,100),600,400, "test");
Rectangle r(Point(100,100),Point(300,200));
win.attach(r);
win.wait_for_botton();
}

But how to define a shape (say a circle by that cir() function which is) outside of the main() function? And how to attach it on the window win to be visible?

View 4 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 :: Pointer To N-dimensional Array That Has A Predefined Shape

Feb 12, 2013

dynamically allocated arrays. int (*ttt)[2][10]; If I'm not mistaken this declares a pointer (that's all). This pointer has an intrinsic shape that makes it easier to access row, column without doing my own math to calculate the offset.

ttt = malloc(2 * 10 * sizeof(int));

So I should be able to access elements like this: ttt[i][j].

ttt[i][j] = 123;

But the compiler says: error C2440: '=' : cannot convert from 'int' to 'int [10]'...how to go about accessing a monolithic block of allocated memory using 2 or more dimensions, using some sort of casting to a known shaped array if possible. As opposed to doing i * cols + j type stuff.

View 2 Replies View Related

C++ :: Detect Mouse Position - Square Shape

Jul 16, 2013

I am trying to detect when my mouse is over a item. I can get it working if its a square shape an stuff.

(LOWORD(lParam) > 133) && (LOWORD(lParam) < 154) && (HIWORD(lParam) > 0) && (HIWORD(lParam) < 21)

but how would i detect if its over the white spot in this image? [URL] ....

i just drew a simple shape i need to detect from more edges but how to do it?.

View 7 Replies View Related

C/C++ :: DX9 Program Pauses When Trying To Change Shape Of Object

Mar 9, 2014

And for some reason my program pauses (nothing displays, and my cursor changes to the little "loading" cursor thingy) when it hits line 139. That is where I added an additional piece of code that should change the shape of the triangle while the program is running.

#include <Windows.h>
#include <WindowsX.h>
#include <d3d9.h>
#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

[Code].....

View 5 Replies View Related

C++ :: Shape Class Polymorphism Compiler Error

Dec 10, 2014

Having issues with program to create a shape area calculator with circle square and rectangle. the uml goes as follows:

Where the UML has shape as the abstract class with public area():double, getName():string,and getDimensions:string, rectangle derived from shape with protected height, and width, and a public rectangle(h:double, w:double), followed by a derived square from rectangle with just a public square(h:double), and finally a circle derived from shape with a private radius, and a public circle(r:double).

[URL]

Have linked my program and it is giving me the following compiler errors:

error: 'qdebug' was not declared in this scope line 15 of main

error: cannot declare variable 'shp' to be of abstract type 'shape' line 22 of main

error: expected primary-expression before ')' token lines 29 -31 of main

(note previously had qstring as a header file yet changed to string since I was getting error qstring was not declared in this scope.)

View 5 Replies View Related

Visual C++ :: How To Make A Shape Outside Of Main Function

Sep 9, 2014

I know how to define a shape (here, a rectangle) and attach it to a window in C++ as follows:

Code:
#include <Simple_window.h>
void cir() { Circle c(Point(100,100),50); }
int main() {
Simple_window win(Point(100,100),600,400, "test");

[Code] ....

But how to define a shape (say a circle by that cir() function which is) outside of the main() function that is how to create a circle inside of the cir() function and it returns that circle when I called it in my main() function so that I can attach it on the window win to be visible?

View 14 Replies View Related

C# :: For Loops To Make User Defined V Shape Output

Jul 29, 2014

Write a program to ask a user to input a symbol from the keyboard and to output that symbol in a n X n/2 sized V where n = the width of the V. You must use a loop to process the data

I am stuck at trying to figure out how to do the actual output formatting. This is where I am sitting currently.

string character = "";
int vheight = 0;
Console.WriteLine("Enter the character you wish to use for your V: ");

[Code]....

so Im really just a bit stumped on how to get the actual V shape to be formatted..

View 14 Replies View Related

Visual C++ :: Crescent Moon - Calculate Points On This Shape

Mar 28, 2013

My question is, I have been tasked to draw this shape,

![Crescent Moon][URL] ....

This is to be done using C++ to write code that will calculate the points on this shape.

Important details.

User Input - Centre Point (X, Y), number of points to be shown, Font Size (influences radius)

Output - List of co-ordinates on the shape.

The overall aim once I have the points is to put them into a graph on Excel and it will hopefully draw it for me, at the user inputted size!

I know that the maximum Radius is 165mm and the minimum is 35mm. I have decided that my base [Font Size][1] shall be 20. I then did some thinking and came up with the equation.

Radius = (Chosen Font Size/20)*130. This is just an estimation, I realise it probably not right, but I thought it could work at least as a template.

I then decided that I should create two different circles, with two different centre points, then link them together to create the shape. I thought that the INSIDE line will have to have a larger Radius and a centre point further along the X-Axis (Y staying constant), as then it could cut into the outside line.*

*(I know this is not what it looks like on the picture, just my chain of thought as it will still give the same shape)

So I defined 2nd Centre point as (X+4, Y). (Again, just estimation, thought it doesn't really matter how far apart they are).

I then decided Radius 2 = (Chosen Font Size/20)*165 (max radius)

So, I have my 2 Radii, and two centre points.

This is my code so far (it works, and everything is declared/inputted above)

for(int i=0; i<=n; i++) //output displayed to user {
Xnew = -i*(Y+R1)/n; //calculate x coordinate
Ynew = pow((((Y+R1)*(Y+R1)) - (Xnew*Xnew)), 0.5); //calculate y coordinate

[Code] ....

I am having the problem drawing the crescent moon that I cannot get the two circles to have the same starting point?

I have managed to get the results to Excel. Everything in that regard works. But when i plot the points on a graph on Excel, they do not have the same starting points. Its essentially just two half circles, one smaller than the other (Stops at the Y axis, giving the half doughnut shape).

If this makes sense, I am trying to get two parts of circles to draw the shape as such that they have the same start and end points. Currently all I am getting more a 'half doughnut' shape, due to the circles not being connected.

View 1 Replies View Related

Visual C++ :: Draw A Shape Or Font On Dialog And Then Fill The Outline?

Jul 8, 2013

I am trying to draw a shape or font on dialog and then fill the outline. I have 2 buttons on this 2 buttons I have the following code

Code:
case IDC_BUTTON1:
MessageBox(hDlg, L"Start Drawing!!", L"ButtonPressed", MB_OK | MB_ICONEXCLAMATION);
hDC = GetDC(hDlg);
brush = CreateSolidBrush(RGB(128, 128, 128));
SelectObject(hDC, brush);

[code].....

When I remove the BeginPath() and EndPath() functions my lines are being drawn. But when I insert this BeginPath() and EndPath() and StrokeAndFillPath(hDC); the nothing is being drawn.

Why it is not doing as per the expectations. I want to draw a shape for example A with a outline. And i want it to be closed when drawing is ended and filled the hollow portion.

What am I doing wrong in this ?I am not implementing it in WM_PAINT but drawing is done in WM_LBUTTONUP.

View 6 Replies View Related

C++ :: Draw A Crescent Moon Shape And Extracted Values To Excel To Be Drawn

Mar 28, 2013

I have some code that will allow me to draw a crescent moon shape, and have extracted the values to excel to be drawn. However in place of some numbers, there is '-1.#IND' in place.

View 3 Replies View Related

C++ :: How To Read Selected Letters

Jun 1, 2013

I have a text file in which i need to read only selected letters and substitute them with integers to calculate.

Eg:-
In the text file
f2,h1

Here i need to read only the the letters f & h and substitute them with some integer and add them up.

View 1 Replies View Related







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