C Sharp :: Storing Positions Of DrawRectangle Into A List - Only Stores Last X And Y?

Oct 12, 2012

I am trying to store values of X and Y into a list like this:

if (pictureBox1.Image != null) {
                    draw = true;
                    Graphics g = Graphics.FromImage(imageFile);
                    Pen pen1 = new Pen(color, 4);
                    g.DrawRectangle(pen1, e.X - 3, e.Y - 2, 5, 5);

[Code] ....

It stores all the nodes but it stores them as the same position, I am not sure how to make them act independently.

View 2 Replies


ADVERTISEMENT

Visual C++ :: Application Which Stores Information About People Along With Task List

Dec 19, 2012

Basically the question is to develop an application that allows: Create an application which stores information about people, along with a task list.

The user should be able to Store people's information

Name,
Age,
Telephone number,
Address

-Retrieve information by entering name
- Remove a person's record by entering their name
-Return records for all people, sorted according to an information type other than age
-Enter a task which needs doing, a priority entered for its urgency
-View highest priority task on the list
-User should be able to remove highest priority item on the list

How to develop this application on a console command line interface style or any other style.

View 2 Replies View Related

C++ :: Storing A List Of Values?

May 1, 2014

I have a list of integers that i wish to store in some kind of array. However i do not know how many integers are needed to be stored each time i run my program so i therefore cannot define a size for my array.

View 2 Replies View Related

C++ :: Storing A List Of Numbers In Integer?

Dec 6, 2014

I am writing trying to store a list of numbers into an integer as bits. So far I have this:

n=n & 0x0f
integer = integer<<2
integer = integer | n;
convert(integer));

I want it to store the integers as bits so that I am move them over and store them farther down the row as more numbers are added, but instead each new number is being added to the previous and I'm just getting a larger integer. Is this even a feasible way to store integers within an integer?

View 1 Replies View Related

C/C++ :: Storing Nodes Into A Linked List?

Apr 18, 2015

I'm simply trying to locate possible logic errors because if I could fill this list properly, I can finish my project very easily. This is just a small portion of a very immersive project.

I am trying to create a linked list that holds objects of type Location *. I have Location defined as

typedef struct location{
char *name;
char *longer;
char *shorter;

[Code].....

I wish to clarify but can not find where to edit the OP. I believe the list is still empty because I attempt to do a simple read through the list by accessing the head and then reassigning the list to the tail of the list. However, the program never enters the while loop

while(world !=0){

View 2 Replies View Related

C# :: Linked List Storing String Values

Apr 8, 2015

I am creating a to-do list application and to store the tasks on the list, I am trying to create a linked list. the code for it so far is as follows:

public class Node //Class for nodes which make up a linked list {
//Declaring the data to be stored in each node and next variable to point to the next node
public string title;
public string description;
public string priority;
public string finish;
public string complete;

[Code] ....

The problem with this arises when I try to create a new node from another class like so:

createForm create = new createForm(); //Creates an object reference to createForm
create.ShowDialog(); //Shows the createTask form for creating a new task
//Declares variables and stores the return value of methods in createForm
string _title = create.getTitle;

[Code] ....

The variables _title etc.. all store values from text boxes as string. However, the code creating the object says the the variables cannot be implicitly converted from type 'string' to 'int'. Why this error is happening??

View 3 Replies View Related

C :: Reading A File Line By Line And Storing It Backwards Into A List

Sep 25, 2013

So I'm reading a file line by line and storing it backwards into a list. So if the file has has this format...
1
2
3
4

The code should store each line in a list as such...
4, 3, 2 ,1

Instead the code will store the last variable in all nodes. So the final list will look like this...
4, 4, 4, 4

Here is my code...

struct node *head = NULL;
int i;
while(read(in, &i, sizeof(int)) != 0) {
struct node *temp = malloc(sizeof(*temp));
temp->line = &i;
temp->next = head;
head = temp;
}

View 4 Replies View Related

C :: Possible To Switch Two Array Positions?

Feb 12, 2015

I have a fundamental question due to my lack of understanding how arrays work.Let say I have a character array (byte array).

1. do array elements have memory adresses? i guess not but ....
2. if yes is it possible to switch two array positions? For examle:

a[x] change with a[y] for x,y < |a|

as oppose to changing values assigned to individual array positions.

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++ :: Calculate Sum Of Numbers In Given Positions

Dec 16, 2013

Question: Write a program that calculates sum of the numbers in the given positions.

Input specification : There will be 4 lines of data. You will be first given the size of the positions array (n). Then, the following line will have n integers which is an ordered list in increasing order and 0 < n ≤ 3000. The third line will give the size of the number array (m) where 0 < m ≤ 5000 and The last line will have m integers between -30000 and 30000.
Note: The positions start from 1 and goes until m.

Output specification : Show one integer number. Sum of the Numbers in the given Positions.

Sample Input I
5
2 5 7 9 10
10
1 8 7 5 17 15 6 7 19 12

Sample Output I
62

View 1 Replies View Related

C :: Guess 4 Int Array With How Many Are In Right And Wrong Positions

Feb 11, 2013

For an assignment I have to create a random array of four integers, and then I have to allow someone to input up to ten guesses to guess the array in the correct order. I also need to be able to display whatever was generated by inputting -1. Finally, after every guess I have to tell the inputter how many of the guessed integers are correct and in the correct position, as well as how many integers are correct but not in the correct position.

So far I've been able to get the random array to generate properly, but inputting negative one has no effect, although if I input it four times in a row I get to my 'lose' condition. Also, it only seems to allow the user to input 4 guesses and not 10 before going straight to the 'lose' condition. I need to get these issues sorted out before I can move on to showing how many guesses are right etc....

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time (NULL));

[Code] ....

View 3 Replies View Related

C++ :: Program To Swap Positions Of Digits Of User

Oct 11, 2014

I'm using code blocks ....

1.Write a program to swap positions of digits of a user entered three-digit integer N, where N is equal or between 101 and 999. (i.e. if user enters 389 your program should print 983. If user enters 300 program should print 003). Repeatedly ask user for correct N, if he/she enters an integer N which is not in the range.

2. Given that y= 4*( 1- 1/3 + 1/5- 1/7+ 1/9-...plus or minus 1/N) Write a program using a for-loop or a while-loop to compute and print the sum of first 50 terms of y.

3. a) Write a user-defined function funGx to compute G(x), where

5 if x<-10

x^2 +(5/x) if -10 <=x<-5

x^2 - (5/x-5) if -5<=x<5

x^2 -(5/x) if 5<=x<10

-5 if x>=10

b) Call the user-defined function funGx in main function to compute and print G(x)values for x= -15.5 , x=5, and x= 0.5 in an informative sentence.

View 3 Replies View Related

C/C++ :: Placing Numbers In Random Positions In Matrix?

Oct 30, 2014

i have a problem with a bit of code (part of an as-yet incomplete program that creates a sort of maze with 10 roadblocks, and then finds the shortest route to the exit.

I don't know what it means, to put tags around my code, but I shall try to point out the problem bit clearly. It is not a long segment. This part is all working fine and printing the messages the user needs to see initially:

#include <stdio.h>
#include <stdlib.h>
int main() {
printf("The number -1 shall represent the position of the robot in the matrix.
"
"The number 99 shall represent the position of the exit.
"
"The number 100 shall represent all blocks.
"
"All other numbers represent the number of moves required to reach the occupied space from the robot's position.
");

Below is where is goes bad, and I really am not sure why. The program says it has stopped responding and gets grayed out, and then I get the error message, "An access violation (Segmentation fault) raised in your program.

I have tried using the debugger, and it only tells me it found 0 errors and 0 warnings.

srand(time(NULL));
int initialmatrix [8] [8];
initialmatrix [0] [7] = 99;
int numberofblocks=0;
int randomrow;

[code]....

View 5 Replies View Related

C++ :: Creating Accounts And Stores It On CSV File

Jun 20, 2013

What I am trying to do is a small program that creates accounts (User name, age,...), and stores it on a CSV file. And later I can search for a user and edit some information about him (example, his age).

Here is my code:

#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <string>

Looking at the "old code" ("void searchaccountold()"), I am sure the problem is on the "while" part ("while (myfile >> name >> age >> money)").

It should work, but it doesnt. I am almost sure the problem lies on the ";"... Because the CSV uses cells, and to pass to the second cell I would normaly need an ";" and in my case I have ">>". I have tryed to change them, to use getline, etc... and didnt work.

View 5 Replies View Related

C/C++ :: EEPROM Stores In Int To Char Convert

Jun 25, 2014

I am using eeprom my integer data store in that int =1234 it stores ony character in eeprom. one character is 12 and other one is 34

View 2 Replies View Related

C :: How To Rearrange Structure Element On The Basis Of Positions Given In Other Array

Apr 8, 2013

I want to rearrange the positions of structure elements on the bases of perm_array.

Code:
typedef struct gg{
element d;
int group;
} gg;
gg col_data[16];

[Code] ....

How can i rearrange structure element like {ptr+2,ptr+3,ptr+1,ptr+0} ?

View 2 Replies View Related

C :: Create Structure That Stores Player Name And Score

Aug 8, 2013

We are told to modify this code following the instructions given within the code. It is a tictactoe program.

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

// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player

void info(void) {
printf("

[Code] ....

I've ended up with the following code, but the part about the name of the datafile is giving errors upon running the program.

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

// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player
typedef struct {

[Code] ....

View 4 Replies View Related

C++ :: How To Make Array Which Stores Values From User

Sep 22, 2013

How to make an array which stores the values i'm getting from the users?

For example if i have a function which allows the user to give me values, how can i store them in an array.

View 4 Replies View Related

C++ :: Function That Stores Number Into Integer Array?

Apr 30, 2013

I'm writing a function that stores a number into an array. If the number is greater that the lowest number in the array then it replaces it. The array size is 10. When the number is stored in the array. The lowest number must then be remove.

View 3 Replies View Related

C++ :: While Statement - Calculate Total For Three Stores Payrolls

Mar 26, 2013

I have a program that needs to calculate the total for three stores payrolls.

Inputs would be the three stores payrolls
Output would be the total of all three

I HAVE to use the while statement.

I have also read the articles on the while statement on here and on other sites. I'm having trouble because every site I've seen so far has only been giving examples of numbers(like counting down or repeating a statement so many times).

Code:

#include <iostream>
#include <cmath>
using namespace std;
int main() {
//declare variables
int storePayroll = 0;
int totalPayroll = 0;
int storeNum = 0;

[Code] .....

View 6 Replies View Related

C Sharp :: How To Bind DropDown List

Feb 16, 2013

<asp:TemplateField HeaderText="Group_Id"> 
<ItemTemplate> <asp:Label ID="G1" runat="server" Text='<%# Eval("Group_Id") %>'></asp:Label> 
</ItemTemplate> <EditItemTemplate> <asp:TextBox ID="G2" runat="server" Text='<%# Eval("Group_Id") 

[Code] ....

on running i find this error

Compiler Error Message: CS1061: 'ASP.webform12_aspx' does not contain a definition for 'Group_Item_Name_SelectedIndexChanged' and no extension method 'Group_Item_Name_SelectedIndexChanged' accepting a first argument of type 'ASP.webform12_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 143: </EditItemTemplate>
Line 144: <FooterTemplate>
Line 145: DropDownList ID="G3" runat="server" AutoPostBack="True"
Line 146: onSelectedIndexChanged=" Group_Item_Name_SelectedIndexChanged" Width="133px">
Line 147:</asp:DropDownList>

View 1 Replies View Related

C Sharp :: Convert A List To Buttons

May 27, 2012

I have a txt file of drinks, and I want to meak a list of buttons of it (the txt file is build like this: fanta : 2 ), how can I make buttons of all the drinks ( I get the first one in a button , but not the others).

Dictionary<string, double> drank = new Dictionary<string, double>();
     string[] words = new string[8];
     Button button;
     <Button> BtnList = new List<Button>();

[Code] ....

View 1 Replies View Related

C++ :: Write A Program Which Stores 10 Decimal Numbers In Array

Sep 24, 2014

Write a program which stores 10 decimal numbers in an array. For these numbers accept input from the users. Once the array is populated do the followings:

Display each elements of the array
Display the sum of all the elements of array

View 4 Replies View Related

C Sharp :: Convert Dropdown List To Int Datatype

Mar 16, 2013

I am need to compare 2 items from 2 separate drop down lists. These values are of int type. Say for example 2 drop down lists showing years. Now i need to find out these 2 years selected is greater or nearer to the current year.

I tried converting the values i receive from the drop down lists to int variables. But i am getting error then. I gave it like below.

int tmp = Convert.ToInt32(ddl_1.SelectedItem.Text);

this gives an error like this - Input string was not in correct format.

I need to know how to put an item from a drop down list to a variable of int data type.

View 1 Replies View Related

C Sharp :: Using List Elements As Variable In Query

Aug 27, 2014

I am trying to query an Informix database using a List<T> collection's elements as variables. I can build the list and connect to the database, but I am unsure how to iterate through the list and query the database for each item in the collection.

My list is of type string, and contains Order Numbers. I want to query item information for each order number in the list.

View 1 Replies View Related

C Sharp :: To Create Globe List Of Templates

Jun 23, 2012

//////////////////////////////////////////////
struct FaceTemplate {
public byte [] templateData;
}
List <FaceTemplate> faceTemplates;
////////////////////////////////////////////

I want to create this structure as globally to access this list in every window form. how can i create and how cam i access.

View 1 Replies View Related







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