5,676 Posted Topics
| |
Re: [QUOTE=Duoas;469986]I will assume by the added comment... I also am going to assume ...[/quote] I wouldn't. I've wasted my time making assumptions... :icon_wink: Since you don't want to explain what's going on, just start putting output statements in your code to see if the values are correct as the program … | |
Re: [QUOTE=superrg86;470099]i don't know how to fix this error can any one help me here's my code: [code=c++] StringStack::StringStack(string value) { stackArray = new string[value]; stackVal = value; top = -1; } [/code] [/QUOTE] [I]top[/I] is undefined. [I]stackVal[/I] is undefined. No idea what line the errors are on. What can we … | |
Re: [QUOTE=phasiro;469166]Hi, noob on board. I have some issues with the spliting data according to tab. What i need is to grab multiple inputs from a txt file and generate it into result txt file. the input file reads like; Johnny Bravo /tab S1234567 Systems /tab/tab DT012 VB /tab/tab DT234 Adv … | |
Re: [QUOTE=jaepi;469423]Hello there, I have here a bit of confusion with fread. I have here a .cue file generated in windows. I tried to read through the entire file in windows and when I printed the buffer, it gives me the correct content of the file, but when I read it … | |
Re: Use an array initialized to underscores. Then for each letter guessed correctly, replace the appropriate values with the letter guessed. Then you can output this array. | |
Re: [QUOTE=banditt_77;468603]I was just looking of ideas and clues on how to do it or understand how to go about it using a while loop, I'm just trying to learn how to write simple programs this is by no means some kind of homework. I'll take the post off if you … | |
Re: [icode]char Data = char();[/icode] What is [I]char()[/I]? [I]string()[/I]? [I]int()[/I]? These lines I assume give you an error, therefore you have no idea if your [I]while[/I] is messed up. [ICODE]in >> Data[/ICODE] What are you expecting to read with this line? [ICODE]while (!in.eof())[/ICODE] Since [I].eof()[/I] is the same as [I]feof()[/I], [url=http://www.gidnetwork.com/b-58.html]read … | |
Re: One possible way to implement this is using a magic square: [code] 4|3|8 ------ 9|5|1 ------ 2|7|6 [/code] It was effective when I wrote TTT the first time. | |
Re: >There were a couple of style changes today so I want to mention them ... Firstly, the [inlinecode] tag has been replaced with [icode] to make it easier / quicker to type. Excellent!!!! >The watermark behind the editor indicating to use code tags (programming forums) and not to solicit or … | |
Re: [QUOTE=lalavoodoo15;467086]Hi, i am trying to make a program that gets words from a txt file (strings) and see if the words have the character the user has inputed before. ----------------------------------------------------------------------------- I have no clue what my next step is.[/QUOTE] Maybe look at the word entered ([I]a_word[/I]) for the letter specified … | |
Re: One possibility to consider is to allow BOLD and ITALIC using language-specific tags. Just a thought. | |
Re: [QUOTE=deadswitch;466473]I've re-worked this code enough times that my brain is about to explode. The following is an (obviously) incomplete version of how I'm starting things off. I suspect some gross conceptual error, but I can't figure it out. At this point all I want to do is get the program … | |
Re: OK, let's look at this thing logically [code=cpp] int main() { long double num = 98; while ( num < 0 || num > 97 ) { cout << "Which Fibonacci Number Would You Like? "; cin >> num; } // you just read your FIBB number into **num** long … | |
Re: [QUOTE=IzzoYourNizzo;467038][B]This is my code, and I can't figure out why its wrong.[/B] for( k = 0; k < n; k++){ avgTemp= 0; total += temps[n]; avgTemp = total/n; }[/QUOTE] [QUOTE=Duoas;467040]1. [B]n[/B] is the number of elements in the array, where [B]k[/B] is 0, 1, 2, ..., n-1. 2. There is … | |
Re: [QUOTE=jacknight;366911]maybe I should update now... [url]http://img.photobucket.com/albums/v281/jacknight/Picture1-7.png[/url] you guys just can't compete.[/QUOTE] Did the bunny get hurt when you finally missed?!?? :icon_cry: | |
Re: [QUOTE=SurviBee;465842]My compiler tells me that I cannot declare the function Primelist(float) without a type...[/QUOTE] [ICODE]main()[/ICODE] is an [I]int[/I] type. What type did you define [ICODE]Primelist(float)[/ICODE]? [QUOTE=SurviBee;465842]... and that the prototype for it does not match any in class 'Primelist'[/QUOTE] Well, how is it defined and how is it used? Are … | |
Re: [QUOTE=jadedreality;466429]Okay, here's what I have so far: [code] #include <iostream> #include <conio.h> void main () { clrscr(); int array [3], t; for (int x=0; x<3; x++) { cout << "Enter integer number" << x+1 << " : " << endl; cin<< array[x]; } for (x=0; x<3; x++) { for (int … | |
Re: Once we cot CODE tags in your post, you have some very nicely formatted code! I don't see where your equation has been implemented. Can you figure out where it should go? | |
Re: [QUOTE=Narue;466333]>Without actually naming letter grade how will it know to save it as that? Dude, are you [I]really[/I] this helpless? When you print the letter grade to cout, print it to outFile too. I completely fail to see how that's not the most obvious solution in the world.[/QUOTE] Hmmmmm... [QUOTE=Narue;466117]... … | |
Re: [QUOTE=sharky_machine;279104]It seems, a lot of people would-- they sell a lot. I wouldn't, probably; I don't really like drinking pop much-- perhaps a [I]Mountain Dew[/I] when I need a caffeine boost and my coffee limit is maxed. Coding [B]all[/B] night, ya know ;) .[/QUOTE] Not sure I understand this... What … | |
Re: [QUOTE=Narue;466045]>Which unfortunately if I understand it does not allow >you to stream the information into an array of strings I don't see that restriction anywhere. In fact, while you're prohibited from using std::string, there doesn't seem to be a restriction on std::vector, so you can greatly simplify how you handle … | |
Re: [QUOTE=venkata;465826]how to print /n[/QUOTE] Start your own thread. Don't hijack someone else's discussion. | |
| |
Re: Sure. Start with your input, make sure it compiles and works. Then add the next step as per the instructions. Compile and test. Keep it up until the program is done. You might want to [url=http://www.daniweb.com/techtalkforums/thread78223.html]Read This![/url] | |
Re: See [url=http://www.gidnetwork.com/b-58.html]this info[/url]. [ICODE]feof() [/ICODE]is the same as [ICODE].eof()[/ICODE] | |
Re: It works either way, but putting the proto in the function IMO just clutters up the function. | |
Re: [QUOTE=ITapprentice;463471] [code] else //c is a single quote { [COLOR="Red"]//How do I make the single quote be counted if there is an[/COLOR] [COLOR="Red"]//alphabetic character to the left and to the right of it?[/COLOR] } [/code][/QUOTE] Probably you want to set a flag that says "I have a quote". And you … | |
Re: Is your task to input a file name, and convert the filename itself to upper case? Or are you supposed to 1) open the file 2) read the file 3) convert the [I]contents[/I] of the file to upper case? And if you don't take the hint on [INLINECODE]gets()[/INLINECODE], we may … | |
Re: [QUOTE=piscean123;464255]Peoples i have tried to make this simple progrem in C... that will print alphabets A to Z and their equivalent ASCII code.. like this A 65 B 66 . . . Z here is da source code...[/quote] Please use English. It's "[I]here is [B]the[/B] source code[/I]. Unless your name … | |
Re: [QUOTE=weasel7711;459943][QUOTE=Ancient Dragon;459748]function printSentence at line 98: you have to save pointer [b]sent[/b] before executing lines 100 thru 102, then use the saved pointer in line 103 because as written that function is destroying the value of the pointer.[/QUOTE] do you mean something like this: [code=c++] void printSentence(char *sent){ *sent = … | |
Re: FORMATTING please.... SPACES and NEWLINES are your friend so the code can be read: [code=cpp] if ((time_and_date[i].start.hours <= 7 ) && (time_and_date[i].end.hours > 7) && (time_and_date[i].end.hours <=16)) { temp_rate = ((count_rate*60) + (time_and_date[i].end.minutes)) * 0.12; rate = (((time_and_date[i].start.minutes)) + (hour_rate*60)) * 0.15; rate_two = (rate + temp_rate); } if ((time_and_date[i].start.hours … | |
Re: [QUOTE=joshSCH;463098]Hey man, you don't have to make a trivial comment to EVERY thread[/QUOTE] You mean like that one? :icon_twisted: | |
Re: [QUOTE=Duki;463631]My code (very few comments so far, sorry):[/quote] Why do people apologise for doing bad things rather than just doing what they know they should? :icon_confused: [QUOTE=Duki;463631][B]My problem is this:[/B] Every run of the program produces the same results. Same damage, same blocks, same double attacks, same winners, everything. I … ![]() | |
Re: [QUOTE=pdwivedi;463661]can u help me what I am doing wrong in above program??[/QUOTE] Yes, read the link you were given twice. It tells you how to do what you want. If not, ask a [I]specific[/I] question. | |
Re: Look up [ICODE]new[/ICODE] and [ICODE]free[/ICODE]. | |
Re: What I'd do is program one step at a time. Using your last description, Start by writing an empty [ICODE]main()[/ICODE] Then write "[I]1. a void function to read in the three test scores and pass them back to main as reference parameters.[/I]" Test this by outputting the parameters after the … | |
Re: And: [QUOTE=coolbreeze;463407] 3. Increase the value of variable x by variable y x= x+y;[/QUOTE] There's another way to do this. Look at double operators. | |
Re: [QUOTE=aaabhish;462795]my code is actually a long around 500 lines. so putting all lines of code is not a gud idea here. suggest me wr i put my codes so that you can have a look on it. and can provide needy solution to me.[/QUOTE] So add output statements to watch … | |
Re: Recursion means you call the function until you get to a specific condition. In this case, you might want to call the function again with [B]n-1[/B]. Then when you get to the [B]n==1[/B] you start returning and add all the values returned to get the value. | |
Re: [QUOTE=nicz888;462851]ok that problem is solved. what i should't of done was put<<endl; at the end. i am stuck at this new problem. here is my problem: the user input a started date for a year, and let said Jan and a year 2000. so Jan 1 2000 started on sunday … | |
![]() | Re: Where's your C++ [ICODE]case[/ICODE] reserved word? ![]() |
Re: You don't need c_strings. Just look for the two characters that begin and end a value you want moved and use the [ICODE]substr()[/ICODE] method to move the value. And why are you indenting 3 miles? Too much indenting is almost as bad as no indenting. 4 spaces is enough for … | |
Re: [QUOTE=meiyantao;462890]Hello,my freinds: I'm writing a program with Qt4.The program can communicate with each other in a LAN. Now,may ererything be ok,but the constructor is wrong,the compiler tells the fallowing: [LIST=1] [*]main.cpp:4: error: new types may not be defined in a return type [*]main.cpp:4: note: (perhaps a semicolon is missing after … | |
Re: The basic flow of the program is not that complicated. You kept it simple enough. There are a few details, though.... First thing I notice is [ICODE]fscanf(fin,"%c", txt[j][i]);[/ICODE] Using [ICODE]fscanf()[/ICODE] to read a character is like opening your front door with C4. It works, but wouldn't a key be better? … | |
Re: [QUOTE=Narue;462215]>How do you clear the console screen without any system-compatibility issues? Start by altering reality such that standard C++ recognizes a "screen" and a "console" in a convenient way.[/QUOTE] In other words, brute force. Outputting a bunch of newlines '\n' is the only portable way. |
The End.