public string[,] StringConvert_tblVFWPost(DataTable dt1) { string[,] stringArray = new string[dt1.Rows.Count, dt1.Columns.Count]; for(int row = 0; row < dt1.Rows.Count; ++row) { for(int col = 0; col < dt1.Columns.Count; col++)
[Code] ....
The error I'm getting is "Cannot implicitly convert type 'string[*,*]' to 'string'". So that tells me what the issue is. However, I'm not sure how to fix it.
How do I change this method, so that it properly returns my two dimensional array?
I have one array with size of 5 and passing this array to one method. I want to get size of the array inside method. If i get size of array inside method, i'm getting only "1",but not "5".
int v[5]; v[0]=1; v[1]=2; v[2]=3; v[3]=4; v[4]=5; cout<<sizeof(v)/sizeof(&v[0])<<endl; // here i'm getting size as 5 CreateArray(v); void CreateArray(int val[]) { cout<<sizeof(val)/sizeof(&val[0])<<endl; // here i'm getting size as 1 }
I am trying to create an array with the size of the first value of one file wich is the same of the first line because the first line only have one value. Here is how i am trying to do it ...
FILE * fich; int test; fich=fopen(nome_ficheiro,"r"); fscanf_s(fich,"%d",&test); int np=test; No*aux=primeiro;
I need to create a method (constructor) to initialize a bigint to an int value you provide [0, maxint].
Example: bigint(128).
Here is my class:
#ifndef BIGINT_H #define BIGINT_H const int MAXINT = 500; class bigint{ public: bigint();
[Code] ....
So if the user inputs (4123 for example). How would I make 4 in size[0], 1 in size [1], 2 in size [2], etc. I don't even know where to start. Im guessing I would start with a for loop. It has to be an integer. I cant use a string yet.
I am wanting to separate the logic from the visual, but I'm having problems when calling the method that controls the actions of the progress bar timer.
Error1error C2182: 'set_Progress' : illegal use of type 'void'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277 Error2error C2078: too many initializersh:cry_devprogrammingc++school_mediaschool_mediaForm1.h277 Error3error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Timer ^' to 'int'h:cry_devprogrammingc++school_mediaschool_mediaForm1.h277
An ImageList_Create() function (see here) takes 2 parameters: cx and cy which are the width and height of each image.
Everything is good if I know in advance what size my images will have. But what if I don't?
Let's say I select 32x32 and my images are sized as 16x16. What will happen with the image list? Or my images are 48x48 and the image list should grow to accomodate the extra space. Since on Windows image list is just one big bitmap, will the height of the image list shrink/grow to 16/48 or not? Is there a way to test such behavior?
The problem I'm having is to check whether the actual images will be truncated when they are bigger that the image list initial size or not or whether I will see some extra space if the images are smaller.
The closest way I see is this function, but I am not sure its the right one to apply to the image list itself and not to the image inside the list.
How to test this properly and reliably on Windows XP+?
Working on an assignment and I've hit TWO stumbling blocks. I now have to take the first line from a .txt file and use that number to determine the size of rows to create in my program. I am using fscanf but the program hangs. How can I read in this number, store it and use it in a for loop?
The second issue is after reading this number I have to print each number in the .txt file under a different column. (Note that it skips a line after reading the row count.) The .txt file is set up as follows:
I've been trying for more than one month to access a method found in a library called libcocosnas_static.a. I'm using Cocos2d-X version 2.0.4. The library has been used many times by my company to make games using cocos2d-1.0.1-x-0.12.0 without any problem.
This is what I've done: 1- I added the include paths of the library to both eclipse and Android.mk 2- Included the .h file using #include "NASPlatformUtil.h" 3- Added the libcocosnas_static.a file to the proj.androidobjlocalarmeabi folder 4- Added "LOCAL_WHOLE_STATIC_LIBRARIES += cocosnas_static" to the Android.mk file 5- Called the function using: NASPlatformUtil:: openUrl("http://xxx.xxx.com/");
I can right click on the function, click Open Declaration and get it without any problem, but the compiler keeps on giving me that dreaded error...
I have a struct called Array and I'm to create a function to create a dynamic array that's fill with randomly generated integers from 0 to 50 (inclusive) and a function to destroy the array for freeing its memory. Below the code that I have written so far.
Code:
* Struct */ typedef struct {int *pArray; //the dynamic array int length; //the size of the dynamic array}Array; /* Function to create a dynamic array */ Array *initializeArray (int length) {int i; }
I need to create a function which will print a list from 100Hz to 1000Hz then 1000Hz to 9000Hz. I have created a function in order to calculate and set up the frequency values from 100Hz to 9000Hz using two for loops as shown below. However I am unsure how to return this to the array at the main.
int main(void) { double Frequency[18]; system ("PAUSE"); return(0); } double Frequency (void) { int count;
I have to create a program that accepts 10 numbers from user, and then I display a list of the numbers, the smallest one and the higher number. I have problems with displaying the smallest and higher number, I tried to Array.Sort and Array.Reverse, but I don't know what I'm doing wrong, this is my code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace SmallAndLargeGUI
[Code] ...
Also I tried to set
if (x == 10) numberTextBox.Enabled = false;
to block the textbox when the user has entered 10 numbers, but didn't work either...
I'm having trouble returning a char array by a function, here's the code. The problem is the 'reverse' function, the purpose of the function is to send two char arrays, 'newline' containing the char array, reverse it and place it in the 'rev' char array then output it back in main, however the output remains blank so I assume there must be something wrong with the reverse function.
Code: #include <stdio.h> #define MAXLINE 10 int fgetline(char line[], int maxline); void copy(char to[], char from[]); void reverse(char forw[], char rev[], int arrsize);
I have a program that is trying to find all factors of an integer given. It needs to be done in a recursion function. Right now i have code similar to just getting the prime factors of a integer.
unsigned int * find_factors_using_recursion(unsigned int x ) { unsigned int * factor = new unsigned int[];//do i put x in here ? for(unsigned int i = 2; i < x; ++i) { if(x % i == 0) { find_factors_using_recursion(x / i); *factor = (factor[i] = i); } } return factor; delete [] factor; }
When i cout the *factor = (factor[i] = i) it gives me the prime numbers of the integer passed into the function but when I return the pointer it only returns one of the prime numbers. I'm new to c++, how to return pointers from functions that would be great with an example to go with it.
I know how to pass a 2-D array to a function. The prototype for that is void f(int (*p)[2]) assuming the array is of integers and there are 2 columns in it.
However, if I wanted the same function to return a pointer to a 2-D array, what would be the prototype?
charArr = new char[50]; cout << "put in value: "; cin.getline(charArr, 50); some_func(charArr);
[Code] ....
Let's say I enter a value: 101
It goes into the if statement but clearly I've enter 1s and 0s. When I debugged, at i = 0, the charArr[i] gives me a value of 49 when assigned to an int variable. But when I cout charArr[i] it gives me 1.
So I'm going to assume 49 is part of the address? How can I correctly check the if statement condition?
I do not have code - I am just wondering if I have a method which gets input from the keyboard and returns it, how would I store that information in a new method after calling it and put the result of it into an array.
I have been trying to make a function that compares all the values of the array and if they are all equal will return a value to print true. The problem I am having is that regardless of what values I enter the function is always returning true. Any way to tell the program o check all the values in one command instead I put them each,
This a very simple program I created because I dont understand how do this. My goal is to be able to use the pointer *s5 throughout the program. For example I would to like to call other functions and pass that pointer through the function. I understand the dynamic allocation and pointers for the most part but Im confused here because the "new char[20]" variable will die after the function and I dont want it to.
#include <iostream> #include <cstdlib> #include <cstring> using namespace std; void testArray ( char *s5 ); int main ( int argc, char *argv[] )