5,676 Posted Topics

Member Avatar for PrimePackster

#1) What [B]zeroliken[/B] said #2) It's C++. Why are you using the terrible and dangerous [B]C[/B] function [iCODE]gets()[/iCODE]? Use [iCODE]getline()[/iCODE]. #3) [ICODE]cin[/ICODE] is your problem. Reading an [I]int[/I] leaves the NEWLINE in the input buffer. The solution has been explained many many times on this site -- do a search.

Member Avatar for PrimePackster
0
184
Member Avatar for Torf

[QUOTE=Torf;]Hello, I do not understand the following parts in bold - how it works, what is is for..etc. I'm not following the book's explanation..[/quote] It called a prototype. If you [I]use[/I] the function (line 17) before you [I]define[/I] the function (line 30) the compiler does not understand line 17. Therefore, …

Member Avatar for MandrewP
0
284
Member Avatar for thecoolman5

Output your values at key points in your code to 1) make sure the variables contain the values they should 2) make sure the IF is processing the correct code

Member Avatar for thecoolman5
0
270
Member Avatar for hamby

It's because the input you are probably using, by definition, stops inputting at a SPACE. Your error is not in the code posted.

Member Avatar for Mr_Null_andVoid
-1
1K
Member Avatar for kashmir323

You've been waiting 4 years to get back to this program? No wait... First post -- resurrecting an old thread -- for no reason other than stating [I]something[/I] doesn't work, but not explaining [I]what[/I] doesn't work. [B]FAIL!![/B] Start your own thread and ask a [B]real[/B] question.

Member Avatar for WaltP
0
2K
Member Avatar for theCompiler

[QUOTE=theCompiler;]can someone please tell me how am i suppose to start my program ?[/quote] Open the editor in your IDE Type in the program you designed to solve the problem. That's how to start your program. [QUOTE=theCompiler;]i have 20 integers (1-20) the user will input what number should start and …

Member Avatar for WaltP
0
133
Member Avatar for poolet

Create a function to read the numbers. Search this site for ways to read characters in number inputs. It's been answered at least once a month for years.

Member Avatar for WaltP
0
1K
Member Avatar for ahp@aol.in

No, it's because of undefined behavior. [url=http://c-faq.com/expr/evalorder2.html]See this[/url]

Member Avatar for jumbowat
0
804
Member Avatar for balldrix

Try removing the comment indicators at the beginning and end of the code. It might compile better. Help in what? You have to ask a question in order to get help.

Member Avatar for balldrix
0
204
Member Avatar for jaclynkinsey

Do any of your strings, including [I]engine[/I], have a trailing newline? Add output statements at key points in the program to display important values. Like [I]first, last, middle, string[middle][/I].

Member Avatar for Narue
0
378
Member Avatar for Foo_with_a_floo

4 resurrections... Great. [QUOTE=mharicz;]looping statements if n=5, output ******** ****** **** *** * plz answer :([/QUOTE] ... and with a [I]gimme the code[/I] question -- how lazy. Closed.

Member Avatar for WaltP
0
413
Member Avatar for Ararat
Member Avatar for WaltP
0
150
Member Avatar for sharpsplit

We can't help you overcome any problems when we have no idea what the problems are. So far you have given us no information and you have not asked any questions. (adding a ? to the end of a statement does not make it a question)

Member Avatar for savoie
0
162
Member Avatar for vivekpriyadarsh
Member Avatar for RASHIDDDDD

[b][boilerplate_help_info][/b][code] Posting requests for help must be well thought out if you want help quickly and correctly. Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful? Check your post with these checkpoints - what is it [i]you[/i] …

Member Avatar for WaltP
0
139
Member Avatar for sinatra87

[QUOTE=sinatra87;]Is there a simple way to catch the char input and ask the user to fix his choice, similar to the way my program handles a user entering a [I]number[/I] that isn't in the menu?[/quote] Read all your inputs as strings. Test the string for all digits. If correct, convert …

Member Avatar for sinatra87
0
224
Member Avatar for roverphoenix

[QUOTE=roverphoenix;]feel free to edit or modify the code, its been a long time since I have played around with this code :)[/QUOTE] Then you should have played with it before posting. [ICODE]goto[/ICODE] and [ICODE]gets()[/ICODE] are extremely poor techniques in coding. And for a professional? At M$? No wonder updates are …

Member Avatar for roverphoenix
0
422
Member Avatar for blackfireburn

[QUOTE=DeanMSands3;]I can think of two ways to do this. (Also, get rid of the return j. It returns from the main function and exits the program. Get rid of the printf(j) at the bottom. Why do you have it?)[/quote] There's a third possibility that makes even more sense... [QUOTE=DeanMSands3;][B]First[/B]: using …

Member Avatar for DeanMSands3
0
322
Member Avatar for jaai
Member Avatar for RickCJ7
Member Avatar for BitBlt
0
1K
Member Avatar for rfrapp

1) use an array to add up the numbers ([iCODE]int roll[6][/iCODE]) 2) calculate your random [I]answer[/I] (do not add 1 giving 0 => 5) 3) use [I]answer[/I] as an index into [I]roll[][/I] and increment ([iCODE]roll[answer]++;[/iCODE]) At the end of the loop, [I]roll[3][/I] will contain the number of 3's "rolled".

Member Avatar for WaltP
0
160
Member Avatar for Azmah

[QUOTE=chibex64;1620883]Can't remember 'BIDMAS' if at all i know it. All i know is 'BODMAS' [and the others][/QUOTE] Never hear of any of them. The only acronyms I remember is "Every Good Boy Does Fine" and "FACE". They are very mathematical, too. By the way, it's [B]math[/B], not [B]math[I]s[/I][/B].

Member Avatar for BDove
0
2K
Member Avatar for simplypixie
Member Avatar for Narue
0
201
Member Avatar for YAMNA MIDHAT

Standard C cannot do what you want. Input is only accepted using the ENTER key. You have to go into non-standard specialized code that most compilers do not contain.

Member Avatar for WaltP
0
189
Member Avatar for gourav1
Member Avatar for gourav1
0
275
Member Avatar for naz1234

[QUOTE=DJSAN10;]Just another suggestion how you could do it.. (No need of using do while) [CODE] while(1) { if(...) { } else if(...) { } else if(...) { } else break; }[/CODE][/QUOTE] This is a terrible suggestion. A while loop is designed to exit when a condition is met, which is …

Member Avatar for DJSAN10
0
136
Member Avatar for capton

With what? Formatting? OK, [url=http://www.gidnetwork.com/b-38.html]here[/url]. Stopping the program from inside the function? Don't. It's a bad practice. Return a value that indicates what to do in [iCODE]main()[/iCODE]

Member Avatar for AceStryker
0
2K
Member Avatar for DarkPyros

[QUOTE=subith86;]Use getch() function defined in conio.h thereby you can avoid using scanf() to hold the output screen.[/quote] Very bad suggestion. [ICODE]getch()[/ICODE] is 1) not portable 2) not Standard C 3) defined in very few compilers The appropriate function to use is [ICODE]getchar()[/ICODE] because it is 1) portable 2) Standard C …

Member Avatar for WaltP
0
205
Member Avatar for Ararat

Don't use [iCODE]gets()[/iCODE] [url=http://www.gidnetwork.com/b-56.html]Here's why[/url]. What he's saying is 1) Input the information as a string with [CODE]fgets()[/CODE] 2) Test each character to make sure it's all digits or 'EXIT' 3) If all digits, convert to integer with [CODE]atoi()[/CODE] [QUOTE=Ararat;]can you maybe translate that into a code since I don't …

Member Avatar for prakash2813
0
1K
Member Avatar for Diogo Martinho

Try [CODE] cout<<"Name:"<<endl; std::getline(std::cin, name); cout<<"Phone:"<<endl; std::getline(std::cin, phone); [/CODE] Mixing line inputs ([I]fgets/getline[/I]) with [I]cin[/I] is causing problems because they both do things differently. [I]cin[/I] is leaving the input stream dirty (stuff left in the buffer you aren't expecting).

Member Avatar for WaltP
0
219
Member Avatar for paulmcco
Member Avatar for nezachem
0
439
Member Avatar for MooGeek

[QUOTE=DanielMilstein;]This is again one of the stupid ways of spammers out there who want nothing but money from you, when you will contact them they will have some false sob stories with some pictures that are very difficult for a normal person to view..[/QUOTE] From experience, I assume? :icon_twisted:

Member Avatar for WaltP
0
203
Member Avatar for Ararat
Member Avatar for Reverend Jim

[QUOTE=Dcurvez;1732123]wonder if there is a way to just not allow certain words in the subject line? (help, urgent, ect..) im also not versed on websites (barely understanding vb) but, just an idea is all (and not really sure if its a good one LOL)[/QUOTE] What part of [QUOTE=cscgal;1731278]Hold your suggestions …

Member Avatar for diafol
0
240
Member Avatar for gourav1
Member Avatar for subith86
0
106
Member Avatar for Varun Bhat

Lots of problems in this code... [CODE]#include<stdio.h> #include<conio.h> // unnecessary, non-standard -- should not be used #include<stdlib.h> #include<string.h> #include<time.h> void main() // MAIN is not and never has been a 'void' -- see below { int i[100]; // create an array from i[0] to i[99] int j[100]; int k; int …

Member Avatar for WaltP
0
170
Member Avatar for annonymous21

My main problem is your lack of consistent formatting and really deep indents. It makes the code very difficult to follow. [url=http://www.gidnetwork.com/b-38.html]See this[/url] for better formatting techniques.

Member Avatar for annonymous21
0
329
Member Avatar for Raymond10

[QUOTE=Raymond10;]Sorry but I'm not very good at explaining...[/QUOTE] Then why don't you post an exact example of what you want the output to look like? It's always easier to [I]show[/I] than [I]explain[/I], although both are important.

Member Avatar for Raymond10
1
137
Member Avatar for supereng

Have you designed the program yet, or are you just tossing code around to see it it works? This is the type or program you need to plan before starting to code. Design a [I]roadmap[/I] of what needs to happen 1) when you find a directory 2) when you start …

Member Avatar for ChrisPadgham
0
610
Member Avatar for manhthaodn

In [iCODE]main()[/iCODE] you use 2 to convert to binary, correct? What would you use for hex?

Member Avatar for WaltP
0
393
Member Avatar for mits28

[QUOTE=mits28;]can you please tell me some books and sites for reference...i want to learn HTML and web designing..from basics to higher level..so that i could design website[/QUOTE] [url=http://lmgtfy.com/?q=html+reference]Try This[/url]

Member Avatar for jonywags
0
230
Member Avatar for Webmastergrace

[QUOTE=Webmastergrace;]let me know what flush(stdin) describe. is ti any kind of function or something else................... try resolve my problem[/QUOTE] [ICODE]flush(stdin)[/ICODE] describes something that knowledgeable programmers would never use. [url=http://www.gidnetwork.com/b-57.html]See this[/url]

Member Avatar for WaltP
0
73
Member Avatar for happygeek

They need help for their homework or project and waiting a few days is a good thing? How long would [I]you[/I] wait when you need help with a problem? I'd expect [I]everyone[/I] would just go somewhere else.

Member Avatar for Dani
2
1K
Member Avatar for joydsouza90

Don't know. Have you tested the [I]hidemouse()[/I] function outside of this program?

Member Avatar for sourabhjaiswal
0
1K
Member Avatar for kartik bodala
Member Avatar for adityatandon

Just look in the .lnk file or right-click and select [I]Properties[/I]. Then copy the location right out of the link file and put it into your 'launch' program. Then you don't need all this Rube Goldberg crap. An .exe to call a .bat file to call a .lnk file to …

Member Avatar for adityatandon
0
900
Member Avatar for Smartflight

[QUOTE=Smartflight;]The aim is simple: Input a string from the user, input a word that is to be searched in the string, and return "Found" or "Not found" I have worked down the following code, and it works. [CODE]#include <iostream.h> #include <stdio.h> #include <string.h> void main () { char para[200], word[20]; …

Member Avatar for Smartflight
0
15K
Member Avatar for vegaseat

Maybe you should read this Code Snippet then, as well as the posts. Follow the code using pencil and paper to understand code in general.

Member Avatar for codinghavok
1
769
Member Avatar for DalekThay

[QUOTE=DalekThay;]Can anyone explain me how to find a point on circumference. The data i have is radius and the coordinates of circle center. I tried to get it by using (x-a)^2+(y-b)^2= r^2 formula but i get stuck. I'm not asking for solution but for explanation.[/QUOTE] Getting "stuck" tells us nothing. …

Member Avatar for WaltP
0
181
Member Avatar for Hazkhan

[url=http://www.gidnetwork.com/b-60.html]See this[/url] and [url=http://www.gidnetwork.com/b-43.html]this[/url].

Member Avatar for adityatandon
0
2K

The End.