C++ :: Define Variable That Is In HEX Value
Aug 31, 2013I want to define variable that is in HEX value & has 64 bits.but I dont know what I can use.....I use unsigned long long but it doesn't useful.
View 2 RepliesI want to define variable that is in HEX value & has 64 bits.but I dont know what I can use.....I use unsigned long long but it doesn't useful.
View 2 RepliesI want to write encryption algorithm.first af all I need to define variable( binary input ) that it is 256 bit but I dont know what should I use...then I want to XOR this to variable ( a & b ) ( each of them is 256 bit)
View 6 Replies View RelatedI just compiled some code I've been working on at a different OS/compiler and realised that Code: sizeof(unsigned long) returns 4 in one pc and 8 in another.
I've heard that bytesize conventions for basic variables were not particularly "universal" before but this is the 1st time I've had a problem with it.
how do I make a typedef that clearly indicates to whatever compiler compiler I want u32 to be an 32bits unsigned and u64 to be 64bits?
I have to create a program that read two numbers and the math operators +, -, * and /. After that I should print the operation required. But I tried to declare a <symbol> variable as char type, without sucess...
Here goes my script:
float num1, num2, result;
char symbol;
printf("Write two numbers:
");
[code]....
I am trying to understand how to get the following value from a define. The code i am trying to understand is as follows:
Code:
#define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET {0xF000}
Code:
#define RADIO_CONFIGURATION_DATA {
Radio_Configuration_Data_Array,
RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER,
RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH,
RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP,
RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET,
RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD
}
and also have this
Code:
typedef struct {
U8 *Radio_ConfigurationArray;
U8 Radio_ChannelNumber;
U8 Radio_PacketLength;
U8 Radio_State_After_Power_Up;
U16 Radio_Delay_Cnt_After_Reset;
U8 Radio_CustomPayload[RADIO_MAX_PACKET_LENGTH];
}
tRadioConfiguration;
so then in the api i have the following
Code:
for (; wDelay < pRadioConfiguration->Radio_Delay_Cnt_After_Reset; wDelay++); .
so my question is how do i declare my variables, correct terminology ?, to achieve this.
I have one small doubt in arrays. Is it possible to define arrays like this a[b[10]] ?...
View 6 Replies View RelatedIt is my first time in use lock detect so i didn't now how to start.
how to define the lock detect?
I nead to define an a negative number a normal posetive number i defined like #define RSSI_UP 1 can i write #define RSSI_DOWN -1???
View 2 Replies View RelatedFirst this is my code:
#include <iostream>
#include <vector>
#include <cstdlib>
[Code].....
the blacked content got problems: the error messages are the throat_t::P or throat_t::T is inaccessible.
I want to define a class, which will have two members, for example, vaporPressureStatus and vaporPressure
enum vpStatus_t {nonesense, unknown, known, saturated};
class pore_t {
public:
vpStatus_t vpStatus;
double vaporPressure;
};
when vpStatus is nonsense and unknown, the vaporPressure should not have a value; and if I calculate out a value for vaporPressure, the vpStatus can be set as known.
I am wondering if there is any set, pair or other structure can hold this two members together, so that when I change one's value, the other guy will also change accordingly.
Define a class for a type called CounterType. An object of this type is used to count things, so it records a count that is a non-negative whole number.
Include a mutator function that sets the counter to a count given as an argument. Include member functions to increase the count by one and to decrease the count by one. Be sure that no member function allows the value of the counter to become negative.Also, include a member function that returns the current count value and one that outputs the count. Embed your class definition in a test program and run sufficient tests to verify it all works correctly.
What I'm trying to do :
struct foo {int x; int y;};
foo function_example(int x, int y) {
foo temp;
temp.x = x;
temp.y = y;
return temp;
}
Works as is, however when I try doing it through seperate class files :
//header file for class example_class
struct foo {int x; int y;};
foo function_example(int x, int y);
//source file for example_class
foo example_class::function_example(int x, int y) {
foo temp;
temp.x = x;
temp.y = y;
return temp;
}
I get an error telling me that foo is undefined, and that declaration of function_example(int x, int y) is incompatible with the declaration of it in the header file.
I have written code for a timer. with everything and i want to include this so i dont need to write or copy the reqd code each time. how do i do this?
View 9 Replies View RelatedIf I’m trying to define an optional one to many relationship I need to reference the primary key of the table
e.g
modelBuilder.Entity<TCC_ArchivedIntegrationExceptions>()
.HasRequired(t => t.TCC_TransactionHistory)
.WithOptional(t => t.TCC_ArchivedIntegrationExceptions);
Where TCC_ArchivedIntegrationException is the optional key.. but those models are inheriting their key from a base entity
So do I have to create the key explicitly in the model or is there another way around this?
When are you creating fields/properties for specific classes and when you are not doing it but creating them inside just lets say straightaway inside some methods within that classes. I mean if i got class where inside i want to create instance of some other class and then pass this instance to another class - should i create a field for it within class i am doing this operation or not? I was always reading that you create field/properties when its belong to class itself. So if i want only to create some instance outside class i am working and pass it to other class and this is not exactly the part of this class shouldnt i create a field for it and just create it inside method?
View 5 Replies View RelatedI want a speed of O(1) in search, insertion and deletion.
is std::map<> the way to go?
In C++ there are a number of primitives that are not defined in terms of other types. By this I'm thinking
int a = 1;
char b = 'M';
float c = 3.45f;
short d = 0xC3A3;
Is it possible to define your own literal? What I would like to do is have a hex literal for a data type where n = sizeof(data_type). If this type were a big integer, then I would want something like:
BigInt e = 0x13CA9B0C98D983E912DA0B0A9F87E0;
My goal is to assign a value from one contingous chunk of bytes and to not do it with a string.
How can I define type MARKS which will be able to hold 4 elements just like array? I want to access it just like normal array elements using brackets []. In the following struct I want to use such type.
Code:
typedef struct {
MARKS ** pointers;
} ARGUMENTS
void main(){
ARGUMENTS arguments;
[Code] ......
Purpose of the struct ARGUMENTS is to hold 4 pointers to string. I want to mark few positions in string so I can simple access them. E.g. name=John
Code:
arguments[0][0]=0; // begin of the param name
arguments[0][1]=3; // end of the param name
arguments[0][2]=5; // begin of the value
arguments[0][3]=8; // end of the value I mean not to save int but the pointer to the corresponding position.
I am trying to run a simulation with a large number of objects (mainly arrays and vectors). I am not sure where shall I define my objects: inside or outside of the main() function, like the following two structures:
(1) ---------------
//main.cpp
int main(){
array<double, 1000> a_1 = {};
array<double, 1000> a_2 = {};
......
func_1(a_1, a_2, ..., a_100);
return 0;
}
[Code]...
I know there is a question about scope. But besides this question (which seems have no difference between these two structures here), is there any difference in terms of execution performance or security issue?
I've been studying "algorithm" by myself by book. And there's this part - vulnerable point of "define" syntax on recursive programming.
Code:
int max_arr2(int arr[], int arr_len) {
int (arr_len == 1)
return arr[0];
else
return max(arr[arr_len-1], max_arr2(arr, arr_len-1);
.
.
This book says, " function 'max_arr2' is just recursive function, without any problem. but if max() is defined like this,
#define max(x,y) ((x)>(y) ? (x):(y))
and if array is just declined, it will take very long time."
I typed this code and run, and actually it really takes long time.
Is it possible to define and write your own file extension. if so is it an easy process or a complex waste of time. All I want to do is define a source file for a programming language I write.
View 3 Replies View RelatedI want to overload pure virtual function from 3rd party SDK class to put my debug messages like that:
errorStatus aXsaction(){printf(_T("
abort transaction"));transactionManager->abortTransaction();}
#define transactionManager->abortTransaction() aXsaction()
But compiler complains on the minus sign:
error C2008: '-' : unexpected in macro definition
Is it possible to trick the compiler?
It is possible to define the formula of prime numbers in C++ language?
View 1 Replies View RelatedI dont understand the pointers or the parenthesis.
#define PORTA *(unsigned char volatile *)(0x0000)
I have a function, int teleport_to_game(int,float,float); in my class. My question is should I change the int to define a function to a different type?
View 2 Replies View RelatedI'm try to write a program which define a polynomial using a linked list.
1) I fill every node of the list which list is as long as the value of the max power of the polynomial.
2) I print it out the resulting polynomial.
3) I want to re-scan the poly in search for the polynomials with the same index and sum them each other for having only one element with the same index, for instance, if I enter P(x) = 1 + x + x^2 + 3*x^2 + x^3, I want to obtain:
P(x) = 1 + x + (1 + 3)*x^2 + x^3.
I called this function SeekForSameIndex().
But with this example I have 4x^2 + 4x^2 + x^3, losing the firsts members of the expression, I'm behind this problem for days and I do not understand where's the mistake.
Here my code:
#include <stdio.h>
#include <stdlib.h>
struct SPoly {
int coeff;
unsigned int index;
[Code] ....