I have a type casting question. I saw method 2 in my code and it able to compile (The code is not written by me). Can I know what method2 mean? method 1 is understandable. class Base {}; class Derived : Base {}; void main () { //let say I … |
|
Hi, I'm looking for embedded system or os source code example. Just to learn some common error or good way to write some device process. Probably in C or C++. Is there any good suggestion? |
|
I read a sample code from a development kits. The global array is declared without indicating the array size. I wonder is it safe? Here is the code: #include <stdio.h> // For Used Function printf // UART Buffer char uart0_buf[]; // "sprint" UART[0] Buffer char uart2_buf[]; // "sprint" UART[2] Buffer … |
|
I have develop a functor array without class but fail to write a functor relate to class. Here is the code without class int returnOne (void) { int a = 0; a++; return 10; } int returnTwo (void) { int a = 0; a++; return 20; } typedef int (*functor2) … |
|
I'm designing a embedded system and we have to oftenly report system fault in different code module. So I decided to create a source file to keep the error log and I'm building a struct for that. So that, every module reporting the error log and store in a data … |
|
I recently learn about the polymorphism and I don't know what is the purpose to use this feature. From http://www.cplusplus.com/doc/tutorial/polymorphism/ , it uses the child class rather than the parent class. I thought most of the time we inherit and we only use the parent class to access the child. … |
|
Hi, I have a problem on search text from a string. I'm able to find it but my method is slow. Let say I got a string that contain items and I need to find out which items come first. So I find all the item by *.IndexOf("...").* Then find … |
|
I want to convert string to unsigned short. Example "123" equal to number 123 or 0x7B. But i get an error while doing the convertion : "Error 9 Cannot implicitly convert type 'int' to 'ushort'. An explicit conversion exists (are you missing a cast?)" Here is my code: UInt16 usTest … |
|
Hi, I'm facing few problem on textbox : 1. I got plenty of textbox which roughly 500+ and my design haven't done so it might grow. Each of the textbox is represent data received from serial port. To update textbox then i need to write the code line by line … |
|
I got only 1 form, which use to retrieve text from a text file. After that I need to do convertion(convertion of the text file) and display(display the converted text) as well. I manage to have 4 class which are Form1.cs, Convertion.cs, Display.cs and Database.cs. So Form1, Convertion and Display … |
|
I know the purpose of keyword but then I still not really know when should i use. But I sure I will optimize my code. So is it ok to i use volatile keyword on all my variables? So that it won't optimize the wrong thing. |
|
The local pointer will be remove after i go out from that scope? or will remain? Example: int glb1 = 2; int main () { int var1 = 0; fnCall1(); fnCall2(); //at here } void fnCall1 () { int tmp1; tmp1 = 10000; } void fnCall2 () { int *ptr1; … |
|
Hi I know it is unable to inherit 2 superclass and I know why because there is another thread discussing about this. But I just wonder is there a way to solve this problem? |
|
Let say I have 9 boxes. Each box may randomly contain number 1-9.. Each box minimum contain no number, maximum contain 9 number and each box won't have duplicated number. My problem is how do I look for pairs/triple/quadruple of same number in different box. Eg. Box 1 : 1,2,5,6,7 … |
|
[CODE]int game = 3; int ckenonum; const int hkenostore = 4; int hkeno[hkenostore]; const int ckenostore = 4; int ckeno[ckenostore] = {1,2,3,4}; bool kenopass = false; for(int hkenostore = 1; hkenostore<4; hkenostore++) { do{ cout<<"Please enter a unique number between 1 and 15 (" << hkenostore << " of 3)\n"; … |
|
I'm using ARM nxp lpc2368. When I tried to add a assembly code in startup file. It show me a compilation error "invalid constant (e002c00c) after fixup". where the code is [CODE] mov r2, #0xE002C00C //address of PINSEL3 : 0xE002C00C[/CODE] when I refer to this link [url]http://www.ee.ic.ac.uk/pcheung/teaching/ee2_computing/arm/Refcard.pdf[/url] It said in … |
|
Hi,I spent all night trying to figure this out. Could someone take a look and show me what I'm missing? I getting this compiler error: [B]unterminated #ifndef [/B]. But I have [B]ifndef[/B] at the beginning and [B]endif[/B] at the end of the class. [CODE]//Header file. //Class definition for teh stack … |
|
C++ was once the King of programming. It would crush any competitor! But, now it seems that C++ is getting less popular. New programmers are rushing to easier to learn, higher level, programming languages (e.g. Java). And with Microsoft coming out with C# which is gaining popularity (even though it … |
|
For you guys, what is the best C++ Compiler? |
|
if i declare size 5 array [CODE]char ch[5]={'1','2','3','4','5'};[/CODE] Then the null will store at the address ch+5 ? even i didn't declare the size for the null to place. If so mean it may overlap value on that memory address? |
|
[CODE]// algo assignment.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int DATA[5]; DATA[0]=0; DATA[1]=10; DATA[2]=80; DATA[3]=1; DATA[4]=5; int a;int temp; int i,j; for (i=0;i<5;i++) { temp=DATA[i]; // at starting it means that it has value … |
|
Hey guys Im trying to create a code where: input A: number Input B: Base Print: Decimal form I am going to use algorithm where u do following: NUMBER % BASE but it would do it the number of times that the base is.. so if its 6 (base 2) … |
|
It's my first time to use functor. So hope can get some guide here. My program need to call different function depend on input. so i thinking to use functor to do that. e.g. main.cpp [CODE]#include "functor.h" #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { … |
|
Well im having this problem on how to add large integers. I have used strings to take in a very large number something that can work on as many digits as you need it to. I take in 2 strings for the numbers you want to add. After which I … |
|
I'm currently choosing which data structure to use for my data logging. Just want to ask for suggestion which type of data structure is better. It has limitation on memory either store in microcontroller RAM or SD card. - I can't know the total type of logging it has. (for … |
|
heyyy guysss....just trying to make a code to proove .999=1 any ideass?? :)) ty!! |
|
#include <iostream> #include "Invoice.h" using namespace std; int main() { string description; double price; int quantity; cout << "Enter the description: "; getline(cin, description); cout << "Enter the unit price: "; cin >> price; cout << "Enter the quantity: "; cin >> quantity; cout << endl;//a new line //create an … |
|
I am trying to get the number of months on one side to pay a car loan off and then the other side to have a decrease in the money owned. I have been staring at this thing for about 2 hours and i dont understand why it won't subtract … |
|
Hello. I am trying to validate a customer number using isdigit. If the user accidently enters a character other than an integer, I want it to allow the user to try again. The problem is it only will check the first number and if that is a digit it it … |
|
Quick question (though I still want to get my long OpenGL question fixed) is there a faster way to Xor the bits of an integer than this: [CODE](MyInt&0x1)^((MyInt&0x2)>>1)^((MyInt&0x4)>>2)//etcetera[/CODE] Just to clarify by faster I mean faster to execute, not to type as this operation will have to be done many … |
0 Reputation Points
~68.6K People Reached
Favorite Forums