1,494 Posted Topics
Re: I just ran your program and got results..What are you compiling/running this on? | |
Re: Its simple really. First, create the memory for your c-strings and then read into them. One method [code] #define ARR_SIZE 100 char cstring1[ARR_SIZE];/*100 character array*/ char cstring2[ARR_SIZE];/*100 character array*/ fgets(cstring1, ARR_SIZE, stdin);/*read into cstring1 from the stdin*/ fgets(cstring2, ARR_SIZE, stdin);/*read into cstring2 from the stdin*/ [/code] | |
Re: Here's a good example hitting the high points of your question. [url]http://www.metalshell.com/source_code/89/Variable_Argument_List_Example.html[/url] [url]http://msdn.microsoft.com/en-us/library/kb57fad8.aspx[/url] | |
Re: First question, you start thread with [code] newThread.Start(DataTimes) [/code] Where is DataTimes defined? | |
Re: Try something like below and it worked for my system. [code] #include <stdio.h> void showbits (unsigned char n) { unsigned char i = 8; for (; i > 0; i--) { n & (1 << (i - 1))? printf ("1"):printf ("0"); } } int main() { unsigned char j = … | |
Re: It doesn't work because the member function 'test' has no idea what pAVec is. pAVec is an instance of the object Member created in main. If you require a copy or reference of pAVec in test then pass it via a function parameter. | |
Re: Uninitialized arrays are bitwise zeroed..The values for a uninitialized int array are zero. | |
| |
Re: Wow, where to begin? First I would get rid of the idea of two arrays and combine them into one array of structures..Like so. [code] struct mys { char * name; int studid; }; struct mys thes[10]; [/code] Before we get into the nuts and bolts..In a C program the … | |
Re: You would probably have better luck with something else...Try getting the MAC address of the network card, that's supposed to be unique. | |
Re: Maybe if you look at this code you'll see what the this pointer is... [code] #include <iostream> class myint { public: myint(int val):itsvalue(val) {} int getitsvalue() const { return itsvalue; } void* get_this() const { return (void*)this; } private: int itsvalue; }; int main(int argc, char**argv) { myint me(1234); std::cout … | |
Re: Narue beat me to the punch... [code] #include <iostream> struct ch8_struct { int field1; short field2; char field3; int field4; double field5; }; int main(int argc, char**argv) { struct ch8_struct g_StructArray[3]; struct ch8_struct *g_pStructArray = g_StructArray; struct ch8_struct **g_ppStructArray = &g_pStructArray; for (int i = 0; i < 3; ++i) … | |
Re: Maybe you should've of asked some questions in your class. On a different note. The forum frowns on students posting homework questions and asking for solutions. Please post what you've accomplished so far and ask specific questions about specific problems. | |
Re: I would look into the modulus operator using it something like below. [code] using System; namespace testit { class MainClass { public static void Main (string[] args) { UInt64 x = 0; Console.Write("Enter a four digit number->"); x = UInt64.Parse(Console.ReadLine()); Console.WriteLine(reverse_it(x)); } public static UInt64 reverse_it(UInt64 num) { UInt64 reverse … | |
Re: On line 57...Try initializing your double variables to 0.0 | |
Re: Yes its possible, that's why it has the void* args parameter. | |
Re: Your giveMemoryBack function should be [code] int giveMemoryBack (int *pCDROM, int *pCDROM2, int *pCDROM3) { delete pCDROM1 delete pCDROM2 delete pCDROM3 return 0; } [/code] Note: Remember to set the original pointers back to NULL. Found something else, your function call [code] // Call giveMemoryBack function int giveMemoryBack(int *pCDROM1, int … | |
Re: Connecting to a MySql database manually is not the way to go...Download the MySql developer files and use that library(MySql's). Note the enclosed code [code] #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <mysql.h>//Note the mysql header file #define SEL_QUERY "select * from personal where lastname = '" #define … | |
Re: If you examine the strchr prototype you'll note it doesn't take a c-string for the second parameter. [code] char *strchr(const char *s, int c); [/code] You'll have to do more than one search if you use this function. ![]() | |
Re: Shouldn't you do your totalPayroll += payrollAmount in the inner loop? As it is, your inner loop just prompts for and accepts a value for payrollAmount. | |
Re: So going from a meager understanding of scanf to posix threads. | |
Re: I just copied and ran your program and it worked. | |
Re: You could create a dynamic array with the operator new. [code] int * a = new int[size]; [/code] | |
Re: If your scanf'ing a variable, you must use the address of the variable...If the variable name is an address(like character arrays) then you don't have to use the address of operator on it. example [code] char my_str[] = "This is my string"; int x = 1234; scanf("%s", my_str);//my_str is an … | |
Re: A question off-topic [code] #include<iostream.h> [/code] What examples/materials are you using that recommend iostream.h? | |
Re: Try this [code] scanf("%s",stud1.oname);//remove the & [/code] | |
Re: Line 97. What is this [code] if(s[i].sMaxCap <= h[0,1,2,3,4,5,6,7,8,9].maxCap) [/code] | |
| |
Re: left node and right node where left node is greater that right node. | |
Re: try [code] float.TryParse(txtInitialTemp.Text, out temp) [/code] | |
![]() | Re: For Linux Kernel Modules I just use [code] obj-m += test.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean [/code] ![]() |
![]() | Re: A big hint is the function name - findnoise. I think the function is grabbing whatever stack value int x happens to have and then applying some operations on it...Hopefully returning a quasi random number. Please note this is just a guess....Actually I never noticed the function passed an int … |
Re: You could try something like below [code] #include <stdio.h> #include <stdlib.h> #include <ctype.h> unsigned long int readNumbersByGetchar() { unsigned long int thisNumber = 0, i = 0; while ((i = getchar()) != '\n') { if (isdigit(i)) { thisNumber *= 10; thisNumber += atoi((char*)&i);/*This only works for Intel/AMD type integers*/ } … | |
Re: First question. What are you trying to do here? Are you trying to create a Windows form with a progress bar? If you are, this simple example should work. [code] using System; using System.Drawing; using System.Windows.Forms; class myform: Form { ProgressBar my_bar; public myform() { my_bar = new ProgressBar(); my_bar.Minimum … | |
Re: In your for statement [code] for(i = 0; i < 10; i++) { printf("value, deference pointer, address \n"); printf("pointer1 = %p, *pointer1 = %d, &pointer1 = %p\n", pointer1, *pointer1, &pointer1); pointer1++;//this line should go last } [/code] Or better yet. [code] #include <stdio.h> int main(void) { int values[10] = {1,2,3,4,5,6,7,8,9,10}; … | |
Re: [QUOTE=aKiLa.. :);1665425]what all should i include to make it look decent?[/QUOTE] A lot of work.... | |
Re: You would be better served if you created an array of structures. [code] #include <stdio.h> #include <stdlib.h> struct mys { int id, size, PerBox; double Price; }; int main() { struct mys thes[5]; return 0; } [/code] | |
Re: Because the data member is const the = operator can't change its value. So using the = operator on any objects from this class will cause an error. Your = operator is defined ~ like so [code] A& A::operator =(const A & obj) { if (this != &obj) { a … | |
Re: Then you have to explicitly refer to the members [code] public void a.b() { // TODO: Add Class1.d implementation } [/code] | |
Re: [QUOTE=shawn.reynz;1665898]please help me.. contribute some codes for indegree and outdegree .. i need it badly[/QUOTE] How about you contributing what you have so far. | |
Re: [QUOTE=tkud;1665544]Declare the variables globally.i.e before main() [/QUOTE] Yikes...Is that good advice? Try reading up on references or pointers. I would try references first before plunging into pointers. Simple reference example. [code] #include <iostream> void square_it(int & i)//pass by reference { i *= i; } int main() { int i = … | |
Re: Try running this code [code] #include <stdio.h> int main(void) { float i=3.3; fprintf(stdout, "%f\n", i - 3.3); fprintf(stdout, "%f\n", 3.3 - i); return 0; } [/code] | |
Re: [QUOTE=Alvi89;1665521]people i still cant figure out the problem :O[/QUOTE] We can't figure out what the problem is...Posting a chunk of code and stating that it doesn't work and then giving a brief but confusing explanation doesn't help us. | |
Re: Try initializing your array elements before you pass them to your function....Just like your error message indicated. | |
Re: [QUOTE=Labdabeta;1664881]So it seems like I should use a DLL, but how do I use a DLL?[/QUOTE] That's operating system specific...Which operating system are we talking about here? | |
Re: It should be [code] fraction fraction::addFractions(fraction two) { //... } [/code] | |
Re: I would try a static member function in myclass to construct the 'hidden' class. |
The End.