a float works well for either whole numbers or fractional numbers. for example, with division, ints will not give a remainder. doubles aren't...
if you're compiling as C code, you need to declare any functions before they're called. You can this by using a prototype or put the function...
if you're asking about storing each line from the file into a variable, then you'll need a 2d array or perhaps a linked list if you don't know how...
char buffer[100]; while(fgets(buffer, sizeof buffer, read_file) != NULL) { ... printf ... } or while(fscanf(read_file, "%s", buffer)...
if you're using a char array, you can use strlen to find the number of chars; if you're using the string class, you can use the member function...
how about preventing a stream error? #include <iostream> #include <sstream> #include <string> int main() { std::string input;...
have you tried a double? scanf("%lf", &double_var); // double or scanf("%Lf", &long_double_var); // long double printf("%2.4f",...
I don't know what data type you're trying but you've got upper limits and overflow to worry about. If you really need a loop of that size, try...
you're assigning i the value of the printf statement, which is 2; 1 for printing the \n plus 1 for printing the %d as the value of i. if you...
Aren't there any examples in your text book? Prompt the user for input, validate it - if it's bad, show a message or if it's good, calculate the...
stuff like if a equals b or a greater than c then take this path else if a equals b and a is less than c then take this path else ... other...
I'd suspect it's undefined behavior because you're trying to modify a more than once in a sequence. int a[] = { 0, 1, 2, 3 }, b[] = {...
Something like this has usually worked for me SendMessage(g_hWndFullscreenBox, CB_INSERTSTRING, ID_FULLSCREEN_YES,...
I don't have access to linux, but I tried the code in VC Express. The "undefined reference" errors cleaned up after adding nrutil.c to the...
That's a lot of rules. :) What you could do is define a deck of cards; for example #define TWO 1 #define THREE 2 #define FOUR...
// if declared in the same scope struct olympics *dynamic = malloc(sizeof(*dynamic) * number_of_elements); or struct olympics *dynamic =...
In standard C, you need to declare variables at the start of a code block. puts("..."); char item[4]; stuff like that won't compile in...
oops - fat fingered the keyboard again. :D #include <stdio.h> #include <stdlib.h> #include <limits.h> int main(void) { char...
I don't have a copy of TC installed so I can't really test with it, but you'd probably want an infinite outer loop that breaks if any key other...
what you might try is a couple of int variables for counters - one for 1s and another for 0s. If you use getchar for the input loop, you should...
Separate names with a comma.