If you want to compare an 'int' to a 'char', go ahead and do it. They are both integers.
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
Type: Posts; User: NickESP
If you want to compare an 'int' to a 'char', go ahead and do it. They are both integers.
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
Characters and Ints are both used to store numbers. The difference is in how those numbers are used by the compiler. For an 'int', the number is used. For a 'char', the number relates to one from the...
The logic looks fine. Have you found out what the error number is?
#include<errno.h>
printf("%d was the error number\n", EDOM);
This might tell you why it failed.
Have a look at the read() function.
EDIT: Oh yeah, I suspect an int would be used as a file position marker. Unsigned can only point at a 4Gig range.
I doubt whether there would be any limits...
memcpy (s_p->cell1[stptr], str, strlen(str)+1);
strncpy (str, s_p->cell1[stptr].string,
strlen(s_p->cell1[s_p->stptr])+1);
Call me crazy, but that should work.
The only thing I can think of is limiting the magnitude of the floats. Or, check for 0.00 and nothing less than that.
if(tax[i] < 0.001) ...
double taxes(double rate,double tax[],double total,char status[],char filing[][2])
{
for(int i = 0;i < 4;i++)
{
if(strcmp(status,filing[i]) == 0)
{
if(tax[i] != 0.0)
{...
Hi,
There are many exercises on this very site. Also, quizzes and programming contests. Just go to the main page:
cprogramming.com
Nick.
Your infinite loop is because of the test condition in the for loop. Replace "size > 0" with "i > 0" and it will work. Oh yeah, in the body of the loop, replace "a[i]" with "a[i-1]" to access the...
Well, I'll give you a hint:
You still have the same number of elements right?
You might want to look at using the '--' (decrement) operator and start your counter not at zero but a different...
Inferno,
As long as the variables are of the same type, they can pass values between them. Or, put another way, in the above code, start is declared as type 'int'. It is 'declared' as type int,...
Hi,
I have just finished writing a very simple tutorial on binary addition, or, how machines can come up with the result of adding two numbers.
I feel it's an interesting topic and one that...
-"I'm actually using an array of stuctures, not just a straight forward array. Is it possible to use vectors with this, or are they contained to normal data types?"-
The vector class is a...
etho,
When you use malloc(); you are getting heap memory. I forgot to mention the use of the function free(). You should do this before your program exits if you are using malloc();
.
.
....
Well, an array is just a coniguous block of memory. You can't delete one element without leaving a 'gap' in your array, as you probably know. So the only way to delete one item is to create an array...
Gday,
You may wish to have a look into function pointers. The basic gist is to define a variable (pointer) that can point to a function. The only catch is that when you declare the pointer, it...
Hi, can you use the old strlen() function? Or, since you're doing it in C++, turn the results into temp string objects (STL) and ask them if they are null?
(sorry if it's a dumb answer, but I'm...
Hello,
I've been programming in C for a few months, and I've recently started to get into C++. I've written an HTML file parser that goes through and extracts the tags from an HTML file. The...
Thanks adrian, I do intend to build it in that style, but probably not on the level of diodes and trannies(You know what I mean..).
The logic is the main thing... It's kind of ironic doing...
Hi, I think the idea of the exercise is to give you trouble. The thing with programming is not knowing all the syntax, but learning how to solve problems. The best way I can think of for improving...
Hello, I have began my software cpu project (lol) with a stab at a logic circuit sim program. Because it will be text based, users will have to draw out a schematic diagram of the circuit, and then...
Sorry about the double spaced posts!
Hey, you sound like you know more than me. But in answer to the
question about the calls, the os uses the defs to map to the
address space of the dll module. In the source code that
...
Hi, I think that K and R holds the most wisdom of any book, but
gleening that wisdom takes a little wisdom. I would advise, as a
fellow newbie, playing around with simple stuff that you think...
I have no idea how much you know about programming, but do
you realise that this header file is used to create a table of calls
for the operating system to use to access a dll file with all...