5,676 Posted Topics
Re: 255 is -1 in 8 bits. 65535 is -1 in 16 bits. Your 255 in the G section is getting promoted to an integer Instead, try shifting then ANDing to get the correct bits, using the 32 bit cast: inline RGB Rgb(int R, int G, int B) {RGB Result = … | |
Re: [QUOTE=ssharish2005;657378]There no any reason on why do we have to convert it binary to hex. At at least i havn;t come across any application which need a that feature![/QUOTE] I have. | |
Re: >i have the whole right code for this program We don't do homework for people here. This is not a cheat site. | |
Re: > the value stays the same 1010 1011 if i use char or unsigned char. even if i use 171 or -85 does not matter, how is it ? The 8 bits used to represent -85 and 171 in binary are identical. For a signed value, the first '1' is … | |
Re: That's what tutorials, books, and teachers are for. We are not a teaching site. Yes, I know it's simple, but you try to do it, and we can help you fix it. | |
Re: Problem is your are using `system(pause)` to pause your run. You are waiting at the OS at that point, not your program. C++ has input functions, like `cin`, `getline()`, etc that waits better than `system(pause)`. Use them instead. There is no reason to call the OS to pause any program. … | |
Re: **Vernon Dozier** said > Indent your code. It's impossible to read. You've ignored him. If you are going to ignore the help you have already been given why should we help you further? | |
Re: > I have problems in this section of the program Are your problems a secret? Or would you care to enlighten us? We aren't psychic... I've noticed most of your initial posts are a comlete waste of your *and* our time since all you do is post code and ask … | |
Re: Even before the pervious question is answered question 2 is nonsensical. C++ could be written in ForTran or Cobol if the creators desired. | |
Re: > I think END keyword will finsih the line and bring the next output in the next line so avoid the keyword. Not quite. **endl** will. Alternate is to use **ends** to avoid the *newline* | |
Re: Do you have a question? A problem? If so, you might want to explain... | |
Re: > 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load\_image' : not all control paths return a value The function `load_image` has returns that do not return a value. > 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load\_image' : not all control paths return a value The function `load_image` has returns … | |
Re: Generate a random number from 0 thru 16777215 (hex FFFFFF) and load the background color property. | |
Re: > I have a for loop like this: > for (i = 0; i < max; i++) { ... } > > But when I run it, i is being set to max > > If I set i to 0 in the first line of the for loop, it … | |
Re: >......???? ......!!!! Reread **deceptikon**'s first sentence in the previous post. Answer *that* question. | |
Re: Don't need arrays. Set *total* to zero Read a number if not -999 Add it to *total* else print *total* And [format](http://www.gidnetwork.com/b-38.html) your code. | |
Re: While \v is something I've never used, I have used \f. On output it will *generally* form feed, kicking out the page when encountered. It's the code that is used when you do a page break in your word processor. | |
Re: > `while(read(readfd, comm, sizeof comm) <= 0){}` What is this supposed to do? | |
Re: `cout` is not C, it's C++. And it also is less versatile than `printf()` | |
Re: >Another disagreement was with braces - where to put them? Since I scan the code more like it is for script languages (like Python), that is ignoring braces and looking only at indentation, I went for the more compact style of putting the opening brace on the same line as … | |
Re: You never defined **tmpstr** except as a pointer. There is no storage space associated. Therefore `strcpy(tmpstr,tekst);` copies into never-never-land, and therefore blows up. | |
Re: Why do people always need to `seek` to get the length of a file? In this case, you want to read the header, right? How big is the header? Just create an `unsigned char` or `byte` array to read in a chunk of the file -- 512, 1024, 2048 bytes... … | |
Re: Almost enough details for understanding.... Do you have a function defined to read a line and do something with all the other data yet? Let's see how many more questions we need to ask. | |
Re: > with no luck, Meaning what? Compiler error? Outputs wrong stuff? crashes the computer? Creates a black hole that sucks in the known universe? What exactly is `isalnum(str firstin)` trying to do? What's **str**? > how do I make it so that it only operates if the first input is … | |
Re: Each character has a numeric value. 'A'=65, 'B'=66, 'a'=97, etc. There are 256 possible values. So read a character. Use the character as an index into `stAlphabet[256]` and increment that value. When you hit the EOF, you will have the count of *all* characters in the file. | |
Re: > I am getting a crazy number of errors that i honestly do not know what is wrong. I am getting a syntax errot before the "int"s in the switch, and conflicting types of all the function names. Any help will be appreciated. Then reread the section in your book … | |
Re: > My problem is when I compile each file separately I get the error: 'Undefined reference to ReadFromfFile()" (Note: ReadFromFile is a function defined in definition.c and I get this error when I compile the main.c file) Your compile is also linking, and definition.c was not specified. > And when … | |
Re: > Finally, a lot of the younger members are probably unfamiliar with flowcharts; they are generally considered obsolete, Really? When did this happen? What superseded it -- at least from a student standpoint? | |
Re: >But I really want to learn about it in c++, because I would like to improve myself in that language :) Why is it people always want to "*improve myself*" doing things that the language makes it difficult to do and can only be done in rare cases in the … | |
Re: Suggestion #1: Do your compares case-insensitive so that **binary**, **Binary**, **BINARY**, and **bInArY** use one single compare. Suggestion #2: Put all the questions (and answers) in a file. Have the questions sorted alphabetically and read them into arrays. Then look up how to do a **binary search**. That will make … | |
When I use **bold** followed immediately by *italic*, the WYSIWYG box shows the post properly. When posted it does not. **Bold***Italic* The above shows properly before posting. | |
Re: >Does this mean I have to create a new project everytime I want to run a single program? Yes. If you made chili in a pot yesterday, would you want to make tomato soup today in the same pot with the leftover chili? You either 1) clean out your pot … | |
Re: > I can not find the problem of this code....... After 300 post one would think you'd know how to ask questions by now. Always **explain** why you think there is a problem. If you don't tell us why you think there's a problem (error messages, bad output, whatever) how … | |
Re: I do... If you want help, you have to provide the work, we can provide direction and suggestions. | |
Re: Close. he functions returns a value from 0 to **n-1**. > `hits[r]++;` `hits` is an array. Increment the **r** *th* element of `hits` > `cout<< static_cast<double>(hits[i]) / (n / 10)` Break it into it's pieces based on the parens and you'll see. Or be more specific in what you don't … | |
Re: > is the problem because of the compiler? No. You have `C++ Strings` and you have `C-strings`. Both are different and **not** interchangable. Some functions have been designed to use C++ strings; some use C-strings. The documentation of each function tells you which one you need to use. Some compilers … | |
Re: > What part of "small, complete program that exhibits the problem" was unclear? Considering "*Hye i am running difftime tu different 2 time values*" my guess would be all of it... ;o) | |
| |
Re: Test each value entered. Make sure something was typed in. Are string.lengths greater than 0? Are numbers not 0? | |
Re: Since the context of your second statement is unknown, and, as it stands, is false, I think you are confusing two different problems thinking they are the same. | |
Re: > If you accidentally hover over, you have to wait for the fade effect to go way. I would find this **exceptionally** annoying. Every site that has those green underlines piss me off every time I move the mouse... | |
Re: >This is homework Really? What makes you think so? You waited 1-1/2 years to make your first post with this newsworthy information??? | |
Re: 1) Turn the computer off. 2) Sit at a desk with pen and paper 3) Write down the functions you need to create (add, delete, search, ...) 4) Take each one at a time and write the steps needed to accomplish them -- in **great detail** 5) Run through the … | |
![]() | Re: Why not just create **array** as a large array? Say `int array[1000]`? The concept of increasing the array size by one for each and every value entered is so resource heavy that I don't really think a useful solution. |
Re: `char sentence[100000];` How many words do you know are 100000 characters long? Wouldn't a shorter 'sentence' be better? And if you only want words, would a variable named **word** be less confusing than **sentence**? ;o) Also, `while(!inf.eof())` -- [see this](http://www.gidnetwork.com/b-58.html) | |
Re: Turbo for Windows 7 64 bit doesn't exist... The last version of Turbo was created in the early 1990's | |
Re: >I have been looking at my loop structure and functions for a while now but cant seem to find the problem. I need another set of eyes to look it oveer and see if they can't point out the problem to me. More than likely it is just a simple … | |
Re: Since you need to keep track of a whopping 8 moves, a stack seems to be overkill. Just add each move to an array. |
The End.