a is a float, 6.7 is a double. When you assign the double to the float you lose some precision. Then, you compare the float with a double which again have different levels of precision and you get...
Type: Posts; User: hk_mp5kpdw
a is a float, 6.7 is a double. When you assign the double to the float you lose some precision. Then, you compare the float with a double which again have different levels of precision and you get...
Does each line only contain a couple characters? If not then you are only counting what is in the second position in your buffer for each line processed. Wouldn't you also need to loop through the...
According to one source I found regarding the %e format specifier in printf:
Which seems to be echoed in another post here.
So, assuming you are indeed on a Windows system maybe you could use...
The read operation happens regardless of what value the state variable has, it runs until EOF is achieved.
You can also get rid of d completely if you wanted and change this loop:
for (b = 0; b<c; b++)
{
d = exp(b*log(10));
e = e + d;
}
To this:
How to hack tutorial by Hackerman.
V[0] represents the first element (the first struct) as opposed to the address of the first element.
You have to initialize it at the point where you create your variable:
const char* bar[] = {"Hello","World"};
const char* const* foo = bar;
while(!feof(fp)) //scans through the file
{
fscanf(fp, "%s%c%s%c%d%c%d%c", &wages[tax_no].surname, &ch, &wages[tax_no].first, &ch,
&wages[tax_no].emp_income, &ch,...
Is the source computer using static or dynamic linking?
As is often the case, the issue can be approached in many ways. One such alternate still using a single loop is: test the result of the value of the counter variable modulus 5 within the loop to...
Oops... see, I'm still learning new things even after all these years. Now, if I can only RETAIN said knowledge in my feeble mind.
Nit:
cout << sizeof(nElementIndex [ARRAY_LENGTH]) << endl;
Since ARRAY_LENGTH is 10, the range of valid index values to use in accessing the nElementIndex array go from 0 through 9...
The i<a.size() part doesn't make sense to me. Should you be using MAX there instead of a.size()?
There doesn't seem to be a need for the i variable, you can drop it and just use count instead.
The code posted would seem to have an error. It attempts to access index positions from the original array p_values that are likely out of bounds with regards to that array. The value of i in the...
The obvious approach would be to pass something into func2 - a string perhaps - from the calling function that indicates who called it.
char ch;
FILE* f;
FILE* f2;
f = fopen(configFile, "r");
if( f != NULL ) // if config already exists, backup
{
f2 = fopen("kernels.bak", "w");
while( ( ch = fgetc(f) ) != EOF )
char c;
...
while((c=fgetc(vlez))!=EOF)
c should be declared as int and not char, this is especially important because of the test being made against EOF..
You should avoid mixing C/C++ I/O (cout/puts, cin/gets). Pick one and stick with it, preferably C++.
If you must use C I/O, use fgets instead of gets.
Const-correctness... member functions that...
char letter;
...
printf("\n\t\t Wanna go back? Type [Y] for yes or [N] for no. >>> ");
scanf("%s", &letter);
FWIW, your code variable is 8 characters and you are treating it as a C-style string when printing using puts which means that it can only reasonably store 7 characters (with the remaining one being...
Cross-posted @ programmersheaven.com
printf("Enter how many states:");
scanf("%d", &n);
for (i = 1; i < n; i++)
Assume you enter 2 for the number of states... this loop will start with i equal to 1. Is 1 less than 2? Yes,...
You've got these bits in several places:
char c;
while((c = getchar()) != EOF) {
Small correction ;)
- Blue color: This tells you the function where the function was called from, the function that the linker couldn't find.