C# :: Arrays / How To Delete Multiple Entries
Nov 2, 2014
I have to create a program that holds three arrays one for the persons last name one for the points scored and one for the player number, now i've got all the arrays and things done but i'm confused as to how i'm going to delete an entry so far the options i've got working are create player, list player, update player, retrieve player and exit.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PlayerSystem6 {
class Program {
static void Main(string[] args){
[code].....
View 4 Replies
ADVERTISEMENT
Mar 5, 2015
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
[Code]....
It compiles just fine and it will add new entries and print the entries just fine but when I go to delete an entry it will delete it but it will mess up the one before it.
View 8 Replies
View Related
Sep 19, 2014
How would I be able to let the user enter multiple heart rates which would all be separate.
Code:
printf("Enter your recorded Heart Rates ");
scanf("%d", &in_rate);
//formulas
if (gender == 'm'){
target = 226 - age;
} else if (gender == 'f'){
[Code]...
View 1 Replies
View Related
Oct 3, 2014
Why multiple entries in combo boxes?
private void Form1_Load(object sender, EventArgs e) {
try {
connection.Open();
OleDbCommand command=new OleDbCommand();
command.Connection=connection;
string query="select * from korisnici,dogadjaji";
[code]...
View 14 Replies
View Related
Aug 17, 2014
how to make subroutines and return multiple arrays.Before that, i wrote my program on matlab. could my program to be structured as following?
<header>
initial value of program;
subroutine1() {
calculating the first work;
return 2 or 3 arrays;
[code].....
View 14 Replies
View Related
Jul 14, 2013
How can I declare global 'delete' operation multiple times? Like, I've an implementation of global 'delete' operation in a file 'x' but I want a different behavior in file 'y'. However, if I override it again in file 'y' I get multiple definition error.
View 3 Replies
View Related
Mar 28, 2014
look at this code:
#include <iostream>
using namespace std;
class teste
[Code]....
Each time i call "x = new teste();" the previous object is deleted? Does this code cause any sort of memory leak?
View 1 Replies
View Related
Jan 16, 2015
I am trying to do this:
Read a text file which is like:
2
2 10 1 2 7
3 8 3 7 7 10 7
The first line indicates how many paths exist in my design.
The second and third lines are those lines(the first number indicates 2 pairs, so 10,1 and 2,7 are 2 pairs)
The first element in the third line indicates 3 pairs and the pairs are 8,3 and 7,7 and 10,7.
I have been able to read the text file and store these into ONE array. However, I need to divide them up and have each line in a seperate array.
So for example
array alpha to contain 10,1 and 2,7
array beta to contain 8,3 and 7,7, and 10,7
How would you do this?
View 4 Replies
View Related
Mar 15, 2013
I currently have globally declared arrays, which are accessed by multiple functions. I want to turn the program so that the arrays are no longer globally declared, but are passed to functions by reference.
I have one problem with passing the arrays: I found that, through debugging, I HAVE TO resize the array when I pass it by reference. For instance, I was using int a[10] when it was globally declared, when it is passed by reference with size 10, it does not work, instead it should be higher than 10 (certain number). Why is this happening? I do not get it...
View 6 Replies
View Related
Apr 19, 2013
I have a txt file that looks like this:
Student ID:97707; Grades: 87.73, 90.41, 91.74, 95.04, 99.13; Name:Davis, Artur
Student ID:23628; Grades: 58.09, 65.18, 68.62, 68.62, 98.05; Name:Davis, Susan
Student ID:49024; Grades: 18.37, 66.06, 68.07, 80.91, 96.47; Name:DeGette, Diana
-I need to read the id, grades and names;
-The id to a separate array
-The grades to a 2-d array
-And the names to a c style string.
Where do I start, im having trouble read the dummy to start
int main() {
char filename[15] = "ex.txt";
string names[MAX_NAMES];
double grades[MAX_ROWS][MAX_COLS];
int id[MAX_IDS];
int index = 0;
ifstream fin;
[Code] .....
View 3 Replies
View Related
Feb 7, 2014
I'm trying to create a function where it allows the user to type in multiple amounts of integers, so if the user wanted to have 3 different storages that hold different integers, the input would look something like this:
5
97 12 31 2 1 //let's say this is held in variable "a"
1 3 284 3 8 // "b"
2 3 482 3 4 // "c"
2 3 4 2 3 // "d"
99 0 2 3 42 // "e"
Since we don't know what number the user will input every time, I'm not sure how to create a dynamically allocated array that will create an x amount of arrays every time.. I want to be able to access each index of a, b, c, d, e or however many arrays there are.
So far, this is what I have, but I'm having trouble creating the arrays since it's unpredictable. I'm purposely not using vectors because I don't really get how pointers work so I'm trying to play around with it.
int* x;
int length, numbers;
cin >> length;
x = new int[length]
for (int i=0;i<length;i++)
{
cin >> numbers; //this doesn't work because it only grabs the first line for some reason
x[i] = numbers
}
View 3 Replies
View Related
Dec 9, 2014
I have to manage a Clinic. I need to delete a booking (for example, if John said he's coming on March 22nd at 15:30 but then he say he's not going to come, I have to delete that booking so another person can use it).
idSearched: the id of the person that is not going to come. I have a lot of specialties and each one has a list. So I ask for the speciality to delete the node (the node contains John's booking). If I don't find it, I return (-1). searchSpecByID return a pointer to the list where the speciality is. So head will point to the first node of the list. In nodeToDelete I have the node I want to delete.
The program detects OK when is the first in the list and when not, but it doesn't delete the node.
Code:
typedef struct bookingList{
tSpecialty specialty;
struct nodo* intro;
} tList;
[Code].....
View 7 Replies
View Related
Sep 26, 2014
Basically, say i wanted to sum all the values enter for x. First, i ask the user how many x's there are, then create a "for" loop to ask for x1, x2, x3, .. xn. Then i want to know the cumulative total of x. How would i do this? This is the sample code i have made right now inside of my main function:
Code:
int N;
int I;
int X;
//This is where i ask for how many x's there are//
}
[code]....
View 4 Replies
View Related
Oct 16, 2014
I'm having trouble understanding how to get my phonebook to print out it's entries. If I just have one entry, it will correctly display it but if I have 2 or more, it leaves out chunks of that entry's data.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
[Code].....
View 4 Replies
View Related
Sep 16, 2014
when i declare local variable x and use it in array,the error is occure that use of un assign local variable.
namespace ConsoleApplication11
{class Program
{
static void Main(string[] args)
{
int x;
Console.Write("enter how many entries you want");
[Code]...
View 2 Replies
View Related
Nov 2, 2014
I'm creating a program that holds three arrays one for the persons last name, one for the points scored and one for the player number, now I've got all the arrays and everything done but I'm not sure as to how I'm going to delete an entry for multiple arrays.
static Int32[] ProcessDelete(Int32[] playerNumbers, String[] playerLastName, Int32[] playerPoints, ref Int32 playerCount)
{
Int32[] newArray = new Int32[playerNumbers.Length - 1];
[Code].....
View 2 Replies
View Related
Sep 3, 2014
This program is an address book where you caan add/view entries. I'm having a problem printing out entries. Why the information isn't getting saved into the structure array?
Code:
#include <iostream>
#include <string>
using namespace std;
struct contactinfo
[Code] .....
View 1 Replies
View Related
Dec 29, 2013
is it possible to create a dynamic array with all entries in it equal to 0?
int** adjMatrix;
adjMatrix= new int*[numOfVertices];
for(int i=0; i<numOfVertices; i++){
adjMatrix[i]=new int[numOfVertices];
}
View 1 Replies
View Related
May 19, 2013
How do you set all the entries in an array to 0 or a particular number...
View 3 Replies
View Related
Apr 21, 2013
Here is my code so far:
Code:
//LINEAR CHAINING OR SEPERATE CHAINING...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX_USERNAME_LEN 15
#define MAX_PASSWORD_LEN 20
[Code] ....
When I compile I get this error:
Code:
simpleauth.c: In function ‘initialize_table’:
simpleauth.c:179:30: error: incompatible types when assigning to type ‘DBEntry’ from type ‘void *’
I am sure its a simple error but I cannot seem to figure out how to set all the entries in the database to NULL. My plan is this:
1. Set all entries to NULL.
2. Check if entry is empty, if empty insert into hash-location, if not increment until empty...
Part 2 seems easy to me, but I cannot set them to empty....
View 3 Replies
View Related
Mar 20, 2014
how to do this? ask the user to input entries of 10x10 array. sort each column into increasing order. print out the array with sorted columns?
View 5 Replies
View Related
Nov 18, 2013
I developed the following heap sort algorithm code, and for some reason anytime it goes above 4100 entries, the algorithm completely crashes. It works perfectly up until that point but I can't see why it would crash?
void heap_from_root(MVector &v, int i, int n) {
int end=n,j=0;
// Identify the lowest root and how many sons it has. If it only has one son, set j=1.
if (n==1) { n = 0; j = 1; }
else if ((n-2) % 2 == 0) { n = (n-2)/2; }
else if ((n-1) % 2 == 0) { n = (n-1)/2; j=1; }
[Code]...
View 6 Replies
View Related
Feb 7, 2015
I am writing a program that deals with 2d arrays. The program inputs the number of rows and columns and asks for the entries. When the program run and compiles it works perfectly until it outputs then it gives me a warning.
Here is my code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int row1=0,col1=0,i,j;
//int a[row1][col1];
int** a= new int*[row1];
[Code]...
I am learning how to do this before I can move on so it can read a text file of numbers.
Also I am having problems with ////delete [] a[];///// I took it out because it made my code compile and run but when I add it in, it gives me an error:
matrixtesting.cpp|56|error: expected primary-expression before ']' token|
I know this expression is suppose to deallocate the array.
View 7 Replies
View Related
Jul 14, 2013
I have an issue with a database call. I've got a database call that counts the number of entries in the database:
private static Int32 dbCount() {
SqlCommand cmd = new SqlCommand("SELECT COUNT (*) FROM Employees", conn);
conn.Open();
Int32 count = (Int32)cmd.ExecuteScalar();
conn.Close();
return count;
}
Afterwards I'm using this as a check throughout my application:
if (dbCount > 0) {
// do something
}
When I execute this code I'm getting the following error: "Operator '>' cannot be applied to operands of type 'method group' and 'int'"
So I'm guessing it has something to do with the cast of the dbCount-object but I don't understand why as I already stated that the count-object to be an Int32.
View 3 Replies
View Related
Jul 14, 2013
I am trying to create a loop to call in the entries from the text file named Set. The entries of Set.txtare :
1 2 3
2 4 5
and so on .. (64 such combinations)[/CODE]
It basically means the first combination for testing is 1 2 3 and next has to be 2 4 5 and so i have 64 such entries defined in set
My test files are located in D://data// and are named tst_data1 to tst_data64.
I created a loop for test set but its incorrect
Code:
// loop for test samples
char basefilename[] = "D://data//";
char , testFilen[160], numiChar[10];
for (int i=1; i<=64; i++) {
strcpy(basefilenme, "D://data//");
strcat(testfilename, Set[]);
[Code] .....
How can i call the Set .txt and how to define it.
View 1 Replies
View Related
Jan 18, 2012
I am developing a program that needs auto start at windows startup. For that I need to add Registry entries. Also the program needs to read some registry keys. What are the functions i need to do these.. Simply I need to
check if the startup key already exists
add a new key if it doesn't exist
read a key values
View 7 Replies
View Related