C++ :: Pulling Integer Sizes Within A Function?
Feb 7, 2013
I'm trying to find the MAX and MIN integer sizes that are entered in by the users. I know that we need to sort [i] and [j] in my function to figure out which is the highest and lowest score correct?
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
[Code].....
View 4 Replies
ADVERTISEMENT
Feb 9, 2015
I have created a game in direct X I am trying to pull data(pictures) from facebook to put into the scene.
I understand I have to get access tokens and then call facebook's graph api.
I am trying to use the C++ Rest SDK.
View 4 Replies
View Related
Jul 6, 2012
I am busy with a project, it is going to consist out of 3 different windows which is logic enough for this whole code to be interactive.
It must be able to pull data into a windows form, displaying it into a textbox, and when you click on the textbox it needs to open up another window where you will have a windows form that will display data as the code loops through the questions in the database.
I am not sure how to push the data that has been selected on the database to the next window..
Here is my code for the first window:
;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form {
//SqlConnection myConnection = new SqlConnection("Data Source=(local);Initial Catalog=KnowledgeEssentials;Integrated Security=SSPI");
//int intType = 0;
public Form1()
[code].....
With the second window the data in the table needs to be displayed and each row from the table needs to have a checkbox next to them, so that if the check box is checked, the relevant information of the checked row will show up in the 3rd window... so MY question is, HOW do I pull that data from that specific database and let it show in the listcheckbox?
View 1 Replies
View Related
Sep 6, 2013
#include <iostream>
#include <array>
#include <sstream>
[Code].....
I need to add thevArr[I] and vArr1[I] and store in vArr2[I] but I cant figure out how to drop the value or replace with a 0 if vArr is bigger than vArr1. IE: 1st number: 123 2nd number: 4567
Ill get something like this:
1 2 3
4 5 6 7
5 7 9 -827349
View 2 Replies
View Related
Aug 3, 2014
I create new dialog window. I add container Fixes and change Fixed properties : - AutoSize, +Expand, +Fill to enable other widgets. I add Text View, Textview is inside GtkScrolledWindow which has property X and Y but not Height and Width. If GtkScrolledWindow has scrollbars, its size is fixed, if not - size depends on the content Textview and grows when I type text. I want not to grow control if I type Text but want my own size. It is possible?
View 7 Replies
View Related
Oct 15, 2013
I'm building a box to take in several arrays of different lengths. one group happens every 10 seconds. one of them happens every 5 seconds. this is from a weather station.
10 sec
subgroupA[14]
subgroupB[24]
subgroupC[17]
subgroupD[12]
subgroupE[34]
5 sec
subgroupC[17]
I plan to retransmit them, substantially unchanged at a lesser rate to save radio power over a serial data link. buried in groupD, I want to change a few chars before retransmit.
I don't want to go to the trouble of doing a structure for each of them since most will be resent unchanged. some entries are chars, some are decimal, some are a mix. I guess it might be convenient to further define groupD, maybe not.
what is the best way to declare the group? I want them to be contiguous since that's how they will end up in the tx buffer. Each subgroup has its own checksum, so I planned it this way to make checksum more convenient.
View 6 Replies
View Related
Feb 15, 2013
I have a paradigm where a integer before gets enqueued to a queue in a vector, the loop of queues is searched and integer is enqueued to a queue which has minimum size among the queues. the following code shows the operation
#include <vector>
#include <queue>
std::vector<std::queue<int> > q
[Code].....
next i am trying to extend my paradigm with the condition, that the integers should be enqueued to the shortest queue until the count of the shortest queue is less than or equal to count of any another queues in the loop of queues.
i want to do something like the code shown below
#include <vector>
#include <queue>
std::vector<std::queue<int> > q
[Code].....
View 4 Replies
View Related
Apr 9, 2013
The size of fundamental types is not guaranteed. Apparently, all the standard guarantees is a hierarchy of sizes, and some minimum representable value range.
Specifically, a char is not guaranteed to be one byte. Also, the sizeof operator always returns 1 for the size of a char, even if the actual size is not eight bits.
Isn't this a huge problem for portability? It seems like 2+ byte characters would break all kinds of things. For example, fstream::write() takes a char * and a byte-length argument. If you ported from a 1-byte-char platform to a 2-byte platform, wouldn't that screw up all your write()s? Worse, you couldn't even detect the problem without trial and error, since sizeof would just lie to you.
I've never actually seen a platform where char wasn't 1 byte, but it sounds like a disaster waiting to happen.
View 6 Replies
View Related
Mar 24, 2012
I am using 2 ARRAYS OF DIFFERENT SIZES in One 2-Dimensional Vector, and my output is not correct. The arrays are size 4 and size 13.
I want COLUMN 0 to have: 55, 66, 77, 88.
I want COLUMNs 1-12 to have 1,2,3,4,5,6,7,8,9,10,10,10,11 in EACH ROW. It would seem that the 2nd loop for the size 13 array would need to loop 4 times in order to fill 4 rows, however, I'm not sure how to do that. Here is what I have so far in code and output:
#include <iostream>
#include <vector>
using namespace std;
int main() {
int typeArray[4] = {55,66,77,88};
int valArray[13] = {1,2,3,4,5,6,7,8,9,10,10,10,11};
[Code] ....
OUTPUT:
55 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 10 10 11
77 0 0 0 0 0 0 0 0 0 0 0 0
88 0 0 0 0 0 0 0 0 0 0 0 0
How to populate rows correctly?
View 2 Replies
View Related
Feb 15, 2014
I'm writing a program where I need to generate a conversion table for wrench sizes with the following columns: Size (Inches) [Fraction], Size (Inches) [Decimal rounded to 3], Next Bigger Metric (mm), Difference (Inches) [Next Bigger Metric-Inches], Closest Metric (mm) [to original size], and Difference (Inches) [Closest Metric-Inches]. I've created the column for the Size in fraction form relatively quickly but I cant seem to produce the decimal version. Instead, I get 0.000.
Code:
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
using namespace std;
[Code] ....
View 4 Replies
View Related
Jul 27, 2013
I have an advanced data namespace in which I hope to be able to read a data variable of any type and transfer it's bytes into another type of a multiple size.
i.e.
char[4] -> int;
int -> short[2];
short -> char[2];
char[2] -> short;
but I'm having some trouble, I get the following errors (because as a template it must compile from start)
template<typename T1, typename T2> void stepBytes(UCHAR size1, UCHAR size2, T1 in, T2& out){
if(size1 == 0 || size2 == 0)
return;
if(size1 % size2 != 0 &&
size2 % size1 != 0)
[Code] ....
So, why's this error appearing?
View 2 Replies
View Related
Feb 28, 2014
I'm working on a homework assignment that asks me to roll two die a user given number of times, find the roll sums, and a few other things. I'm working on it one module at a time and I'm running into two big problems so far.
The first problem is that my int variable rolls changes to a number within the random number generator range of numbers after I run rolldie. I got around this by making a const equal to the user entered value of rolls just so that I could continue developing the program.
My second problem is that the values of the arrays resultsOne[] and resultsTwo[] are changed after running findsum(). Why this is happening and I even tried passing them as const, but that changed nothing. We just started learning about passing arrays to functions, so there might be something big that I'm missing.
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
void rolldie(int resultsOne[], int sizeOfresultsOne, int resultsTwo[], int sizeOfresultsTwo);
void findsum(int resultsOne[], int sizeOfresultsOne, int resultsTwo[], int sizeOfresultsTwo, int tossSums[], int sizeOftossSums);
[Code] ....
View 8 Replies
View Related
Nov 16, 2013
I need to get an integer number with only using getchar() and without pre knowing the number of digits in the integer. And I cannot use strings or arrays.
View 4 Replies
View Related
Nov 14, 2013
why the function is not returning the integer 1 or 0 ... We have two arrays A and B, each of 10 integers. Write a function that tests if every element of array A is equal to its corresponding element in array B. The function is to return true (1) if all elements are equal and false (0) if at least one element is not equal.*/
#include <stdio.h>
#include <iostream>
#include <time.h>
using namespace std;
int TEST (int arrayA[], int arrayB[], int j);
int main() {
srand (time(NULL));
[code].....
View 2 Replies
View Related
Nov 23, 2013
Any good function that get the length of an integer in C++
I do know of str.length(), however i want something similar for integers
View 1 Replies
View Related
Mar 8, 2013
Is it possible to create a function that can both return and display a value. I was trying to make a program that computes and prints terms of the Fibonacci series using a recursive function.
View 3 Replies
View Related
Feb 10, 2013
My code compiles fine but it doesn't seem to want to calculate the max integer. It calculates min and average fine but I'm not seeing what is wrong with my code. The max integer keeps coming out wrong.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <cstdlib>
#include <algorithm>
using std::swap;
[Code] ....
View 1 Replies
View Related
Apr 2, 2014
The problem is how to return an array of integer from a function?
I'm writing a C program code to return an array of integers ( grades of students ) to the main function!
View 9 Replies
View Related
Apr 12, 2014
Code:
#include <stdio.h>
void define (int integer, int IntArr[0], int *IntP);
int main(void)
{int integer = 0, IntArr[1] = {0}, IntP = 0;
define(integer, IntArr, &IntP);
[Code]...
Why does the integer with array change after passing trough the function and the normal integer doesn't? (I know why the normal one doesn't, but I dont get the array one)
View 1 Replies
View Related
May 5, 2014
How to go about making a function that accepts an integer and returns a string with any one of 5 strings containing the name of the object. For example object number 3 might be "Pen". Object 4 might be "Paper".
To do this would I just use an array?
View 4 Replies
View Related
Jun 20, 2013
I must create a function with a integer number as parameterThis function use the parameter for a loop...example
n = 1
output
1
2
3
n = 2
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
View 1 Replies
View Related
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
Jan 31, 2013
I want to write a function which take an integer and return the number of digits in it i.e
int i = 123456
func(i) {
some code
}
output
the number of the digits are 6
View 9 Replies
View Related
Apr 2, 2014
How to write a function that receives an integer array along with its length. the function calculates and returns the sum of the squares of all the odd numbers in the array?
View 2 Replies
View Related
Feb 20, 2013
I have a paradigm in a loop of queues of a vector,if a condition is true,increase sizes of the queue of that particular queue in the loop of queues, if condition is false, the queuesize is left as such in loop of queues. After this operation i need to search the queue sizes of all queues and enqueue in the shortest queue.
I want to do something like the code given below
#include <vector>
#include <queue>
int min_index = 0;
std::vector<std::queue<int> > q
std::size_t size = q.size();
[Code] ....
How to implement this logic?
will q[i].size=q[i].size+5 increase the queuesize by 5 for the ith queue?
View 12 Replies
View Related
Feb 2, 2015
I'm writing code to create an array of integer and let user input choice to display, replace, add new element, etc.I created a header file in the header file there's a function:
Code:
int display_one_element(int* array, int num_of_elements, int position) {
if(num_of_elements < position || position < 0) {
printf("Position out of bound.
");
return 1;
}
return array[position-1];
}
in main I write a function call:
Code:
display_one_element(array, *p_num_elements, position);
My code seems to work fine but there's an error message right next to my function call:
1.too many arguments provided to function like macro invocation
2.Expression result unused
I tried to move the function from header file to c source file. but other functions in the header file works fine and this doesn't work with the error message.
View 3 Replies
View Related