Forum: DaniWeb Community Feedback 8 Hours Ago |
| Replies: 6 Views: 69 One way it was done ages ago elseweb was [code], [quote], and [syntax]. The syntax tags were used for the "fancy" code tags. Quote in monospace to me would look stupid.
[edit]Keeping the fonts,... |
Forum: C++ 16 Hours Ago |
| Replies: 20 Views: 217 Related:
http://parashift.com/c++-faq-lite/input-output.html#faq-15.4 |
Forum: C++ 19 Hours Ago |
| Replies: 6 Views: 83 Well, choose your poison: multiple passes of the same file, or a single read with a buffer. Both are relatively simple, I'd recommend just examining what's there. Experiment a bit. Learning to code... |
Forum: C++ 19 Hours Ago |
| Replies: 6 Views: 83 I suppose you could read the file to count the lines and then back up and only print the last 10.
Why the extra condition now?
Why don't you give the coding a shot first? |
Forum: C++ 20 Hours Ago |
| Replies: 6 Views: 83 I'd just read all lines of the file into a circular buffer with 10 strings, each containing a line. When you get to the end of the file, you will have the last 10 lines stored.
#include <iostream>... |
Forum: C 20 Hours Ago |
| Replies: 5 Views: 106 You'll need to make a lot of changes to your functions given this sort of pattern...
From (extraneous type needs to be removed, multiplication is done using *, feed the pow function the correct... |
Forum: C++ 1 Day Ago |
| Replies: 20 Views: 217 Well, if you don't get an integer because the user didn't enter a valid one, then "(x>0)" makes no sense either. You can do it your way by recognizing input failure and cleaning up the input stream.... |
Forum: C++ 1 Day Ago |
| Replies: 20 Views: 217 I think the basics are here:
http://www.daniweb.com/tutorials/tutorial71858.html |
Forum: C++ 1 Day Ago |
| Replies: 20 Views: 217 My usual advice is to always read all user input as a string. If you want a numeric value, attempt to perform a conversion. If the conversion fails, issue a message or something; otherwise you... |
Forum: C 1 Day Ago |
| Replies: 2 Views: 118 fmod (http://web.archive.org/web/20050207005628/http://dev.unicals.com/papers/c89-draft.html#4.5.6.4) |
Forum: C++ 2 Days Ago |
| Replies: 12 Views: 188 You're going to return from main in one of two places:
int main ()
{
int number;
int counter = 0;
int flags = 1;
bool flag_none = true;
bool fag_yes = false;
cout << "Enter a number,... |
Forum: C 2 Days Ago |
| Replies: 4 Views: 85 I don't see that return c; line. |
Forum: C++ 2 Days Ago |
| Replies: 12 Views: 188 The following code is unreachable:
if (counter < 7 == true)
{
cout << "Number " << counter << " is between 10 and 500" << endl;
cout << "Number " << counter << " is not flagged. " << endl;
}... |
Forum: C++ 2 Days Ago |
| Replies: 12 Views: 188 |
Forum: C 2 Days Ago |
| Replies: 4 Views: 85 while((c = getchar())!= EOF)
And what does your function return for non-alpha input? |
Forum: C 2 Days Ago |
| Replies: 3 Views: 114 team temp[1];
This has only one element: temp[0].
temp[1] = teams1[(j-1)];
teams1[(j-1)] = teams1[j];
teams1[j] = temp[1]; |
Forum: C++ 3 Days Ago |
| Replies: 3 Views: 112 http://en.wikipedia.org/wiki/Comparison_of_text_editors |
Forum: C 3 Days Ago |
| Replies: 3 Views: 139 |
Forum: C 4 Days Ago |
| Replies: 11 Views: 370 C89 is de facto standard for C, and it is also the base of the current C++ standard. |
Forum: C++ 4 Days Ago |
| Replies: 3 Views: 107 It could possibly be a gcc issue.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13741 |
Forum: C++ 4 Days Ago |
| Replies: 3 Views: 107 I get an odd warning:
switch ( opcion ) // warning: unreachable code at beginning of switch statement
{
case 1:I think this has something to do with using the language extension VLA:
float... |
Forum: C++ 5 Days Ago |
| Replies: 7 Views: 222 The template thing is kind of a funky in-between in which an accepted solution is to in fact put the active code in the header: |
Forum: C 5 Days Ago |
| Replies: 2 Views: 149 Hmm.
But x should be an int, as that is what getchar returns. |
Forum: C 5 Days Ago |
| Replies: 2 Views: 163 Clean up the leftover newline in the input stream. |
Forum: C++ 5 Days Ago |
| Replies: 7 Views: 222 I had to patch some syntax errors to get to the link, so I'm not sure why you weren't seeing them. With regard to the linker errors:
http://parashift.com/c++-faq-lite/templates.html#faq-35.12 ? |
Forum: C++ 7 Days Ago |
| Replies: 7 Views: 145 Just sayin'.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
/* Extract value for # of elements in array */
int i; |
Forum: C++ 7 Days Ago |
| Replies: 7 Views: 145 fin.open("numlist.dat");
fout.open("numlist.dat");
Perhaps first open for input. Then after you've extraced what you want and closed the file, then open the same file for output. |
Forum: C++ 7 Days Ago |
| Replies: 9 Views: 183 You might find such a thing here, perhaps in the snippets, maybe a previous forum thread. So a search might be helpful to you. |
Forum: C 7 Days Ago |
| Replies: 2 Views: 139 This is array of pointers to string literals:char *MONTH[] = {"January","February","March","April","May","June","July","August","September","October","November","December"};String literals are not... |
Forum: C 7 Days Ago |
| Replies: 5 Views: 191 int main()
{
FILE *filetext;
FILE *filecopied;
char text[50];
filetext=fopen("filetext.txt","r");
filecopied=fopen("filecopied.txt","w");
if ( (filetext==NULL) ||... |
Forum: DaniWeb Community Feedback 7 Days Ago |
| Replies: 89 Views: 4,158 Yup. I need the flyover to remind me that it means multiquote.
Just press the "quick reply" button, or the "reply to thread" button :)[/QUOTE]Ah, but that's defeatured... |
Forum: DaniWeb Community Feedback 7 Days Ago |
| Replies: 3 Views: 263 I believe your expectation used to be the default behavior. The new default was an "upgrade" a while back. The compromise you see is the result of some complainin'. (If I remember things correctly.) |
Forum: C++ 8 Days Ago |
| Replies: 3 Views: 133 http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 ? |
Forum: C 8 Days Ago |
| Replies: 2 Views: 143 Do you really think this is enough information for any kind of an answer? |
Forum: C++ 8 Days Ago |
| Replies: 3 Views: 123 http://c-faq.com/varargs/index.html
http://c-faq.com/varargs/varargs1.html |
Forum: C 9 Days Ago |
| Replies: 6 Views: 180 I wrote some snippets on parsing some time ago.
http://www.daniweb.com/code/snippet216535.html
http://www.daniweb.com/code/snippet216569.html
http://www.daniweb.com/code/snippet216682.html... |
Forum: C 9 Days Ago |
| Replies: 11 Views: 241 Well, if you wanna go all the way with an unlimited input length I'd feel compelled to ask whether C++ might be an option.
Otherwise in C I might choose to discard characters beyond some "absurd... |
Forum: C 9 Days Ago |
| Replies: 11 Views: 241 Perhaps I misunderstood your meaning of "not a number"? It sounded to me like you didn't want "1%2r1_9" to be considered a number. Instead you are after particular floating point signal-type values? |
Forum: C++ 9 Days Ago |
| Replies: 14 Views: 255 No I don't. But it is working now thank you![/QUOTE]This would be an equivalent:
for ( int x=0; x<3; x++ )
{
/* empty loop */
} |
Forum: C 9 Days Ago |
| Replies: 11 Views: 241 http://www.daniweb.com/tutorials/tutorial45806.html -- the "Read an Floating Point ..." links have additional possibilities better suited to your task. |