1,494 Posted Topics
Re: You don't have a variable to save the day that the max temp occurred on. Plus never and I mean never use a variable in a comparison without initializing it.. int Max; should be int Max = 0;/*Or whatever makes sense*/ | |
Re: Are you trying to display the character's value as a hexadecimal? [code] #include <iostream> int main() { unsigned char myc = 'o'; std::cout << (int)myc << std::endl; std::cout << std::hex << (int)myc << std::endl; std::cout << std::oct << (int)myc << std::endl; return 0; } [/code] | |
Re: do you mean this array? [code] double * dSM = NULL [/code] It depends on the size you pass to new. | |
Re: So what is a [code] brd[x][y].clr="W";//Problem occured here [/code] | |
Re: Not sure what happened here...I posted twice. | |
Re: Because make software comes in many flavors and the script it executes 'can' depend on the operating system...It really depends. | |
Re: Which operating system are use using...Threads are operating system specific. i.e. Threads coded on Linux will not work on Windows. | |
Hi, I have a question about constructors and the difference between passing by value and by reference. If you look at the two examples I attached. Example one has a constructor that passes by value and example two pass by reference. Now I want to know why example one will … | |
Re: I'm not sure what trying to accomplish but you have String and string. If your using std::string in your class then you should include the header file and maybe call your version of string something more unique like maybe My_String. | |
| |
Re: You could write a program and test them yourself...Or you could check here for some examples: [url]http://cplus.about.com/od/learningc/ss/clessontwo_6.htm[/url] | |
Re: Are you sure you didn't invalidate your iterators when you called erase...Try reinitializing you iterators after your call to erase and see if it displays properly. | |
Re: Try adding this line to your program while ((ch = cin.get()) != '\n'){} and read this link to find out what's going on [url]http://www.daniweb.com/forums/thread90228.html[/url] [code] #include <iostream> #include <string> using namespace std; int main() { string *name; // int *votes; int i; int numVotes; char ch; cout << "how many … | |
Re: Use either [code] int* p1 = &p0[0]; [/code] or [code] int* p1 = p0; [/code] | |
Re: Are you talking about binaries? If you are, what do mean view? Do you mean open a binary and view the hex or the original source code. | |
Re: You need to create a thread to run your sound file. | |
Re: Here's a pipe program that forks 5 times, with each child adding a row of the array longarray and then communicating the sum back to the parent... [code] #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #define ARR_ROW 5 #define ELEMENTS_PER_ROW 3 unsigned long longarray[ARR_ROW][ELEMENTS_PER_ROW] = { {1, 2, 3}, … | |
Re: You are kidding, where is your code tags? | |
Re: For starters I would initialize these like so [code] panvowel.shortest[0] = '\0'; panvowel.longest[0] = '\0'; [/code] | |
Re: I'm not really sure what you mean by 'all of a'.... a[0] is equal to 0. a is the address of the first element or &a[0]. | |
Re: I'm only guessing here but should you be using some sort of trig functions to get your points... | |
Re: Try this link: [url]http://www.networksorcery.com/enp/protocol/ip.htm[/url] Actually try downloading WireShark and checking out some headers. | |
Re: Yes there is an easy way. | |
Re: Posting your assignment will produce nothing...Please post the code that you tried and please indicate where your having problems.. | |
Re: Your if statements are wrong. It should be if (condition) {statement;} While you have if (condition) if (condition) if (condition) Plus a = 0 is an assignment(a now equals 0)....You want a == 0 which is a comparison and yields true or false. | |
Re: What's (*q++)++ do? Well lets look inside the parenthesis at *q++. This is basically dereferencing the pointer *q and then incrementing the value *q++. (*q++)++ is incrementing the pointer q. The second for loop? It does the same thing but uses pointer arithmetic differently to achieve its goals. Please note … | |
![]() | Re: I would loop through your string like below [code] #include <iostream> #include <string> int main() { std::string the_string; std::cout << "enter your number->"; std::cin >> the_string; std::cout << std::endl; for (unsigned int i = 0; i < the_string.size(); ++i) { //do your comparisons here // (the_string[i] == 'I') std::cout << … ![]() |
Re: Yes only have one main function. The main function is a placeholder for the start of execution, you can change the name if you inform the linker of the new name but generally you don't. | |
Re: The general rule is, for every time you malloc you have to call free.. Why set a pointer to NULL? Because if you call free on a NULL set pointer nothing happens, also its easy to check if a pointer is NULL by examining its value.. [code] int *ptr = … | |
Re: I would use the class constructor to initialize your vector to the appropriate number of elements. | |
| |
Re: Have you tried running the program via a debugger? | |
Re: How hard is it to google [url]http://www.codingunit.com/c-tutorial-how-to-use-time-and-date-in-c[/url] | |
Re: Try here [url]http://www.hlnum.org/english/projects/tools/threadpool/doc.html[/url] It was hidden in the google query "posix thread pool" | |
Re: Does stuff.txt exist in the same directory as the program? If not use a full path. | |
Re: Maybe you should post your code... | |
Re: The C Programming Language...Why is this posted in two sections? | |
| |
Re: Yes please post what you have so far. We appreciate a little effort on your part. | |
Re: If roll is an int then you can set it to 'q' by simply doing this [code] roll = 'q'; [/code] but having one variable for two independent uses can lead to confusing code. | |
Re: Could you put your question in context by giving us an example... | |
Re: Number one I would change your expression to: char expression; and then call a %c in your scanf. [code] #include <stdio.h> int main() { char expression; while ((scanf("%c",&expression)) != EOF) { fprintf(stdout, "char->%c\n", expression); } return 0; } [/code] | |
Re: Do you mean what is the last element? The last element is array[Index - 1]. Or do you mean how big can an array be? How many elements can it have.... C defines a type called size_t which accommodates the largest arrays. | |
Re: Here's a simple way to make the conversion using snprintf(). [code] #include <iostream> #include <cstdio> int main() { char ans[20]; float myf = 123.0 + (1.0 / 3.0); snprintf(ans, 20, "%f", myf); std::cout << "ans->" << ans << std::endl; return 0; } [/code] | |
Re: Try changing your function to: [code] int burcin(int x) { if (x==1) return 1; else return (x+ burcin(x-1)); } [/code] | |
Re: Create your function like this [code] void increment( int *i ) { ++(*i); } [/code] and call it by passing the address of i [code] increment( &i ); [/code] | |
Re: Try initializing these variables to zero... [code] int i, n, iNumber, iResult, iChoice; [/code] | |
Re: Your copying your string over to a NULL pointer...It points to nothing. | |
Re: Did you forget your semi-colon after your structure? | |
Re: It really depends, are you talking about a string object or are you talking about a c-string? |
The End.