When trying to get the highest and lowest values for an array of integers, it is a good idea to set the values of high and low prior to the loop where the minimum is the highest value possible and...
Type: Posts; User: bigtamscot
When trying to get the highest and lowest values for an array of integers, it is a good idea to set the values of high and low prior to the loop where the minimum is the highest value possible and...
In C all arrays are passed by reference, that is the variable is the address of the first element of the array. The trouble you may be having in the second program which uses pointer notation is with...
Look at where your semi colons are.
for (i=0; i < 9; ++i);
for (j=0; i < 19; ++j);
nums[i][j] = 2*i;
if you are just starting out in C then think on what putting semi-colons at the...
check the FAQ's before posting, maybe then you may find the answer without feeling stupid.
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1031963460&id=1043284385
beaten by pianorain :)
srand() is used to ensure that everytime you run the program that the numbers generated will be unique each run (in theory). rand() is used to generate the random number.
Have a look at the...
Have a look at what employers are asking for nowadays by going to any reputable job site :)
Your best bet would be to get a compiler that is C complient and allows you to run C programs with a C compiler...Have a look here for DevC++...
http://www.bloodshed.net/
this depends on which compiler you are using. You refer to VB so I take it your using VS.NET. I can only guess that it would be the same way as doing it in VS with VB. Forget that, your best bet...
First of...you can't initialize your array of TDirections directly, you will have to do it each element at a time...
// Directions for N, NE, E, SE, S, SW, W, NW, assumming North and West are...
try google...
http://www.google.co.uk/search?hl=en&q=c%2B%2B+and+databases&btnG=Google+Search&meta=
So you dont want to attempt it yourself. How do you think you would go about using a menu. After all it is a selection process and in your case involves characters...
cout << "Shall I answer...
to use strcat you have to pass two array of character parameters. Your second parameter in your strcat call seems to be a single character to me. What you trying to acheive here. If you need to...
get rid of the chevrons in your own header files. They should also be in the same directory as your main file.
#include <stdio.h> // adds a library to program or header
#include "myheader.h" //...
Also you declare tmp as a character array to hold 100 elements (100 bytes of memory) and then read a file at 200 bytes. Just asking for trouble.
do
{
fgets(tmp,200,fPtr);
sscanf(tmp, "%d %s %f %d", &records[i].id, &records[i].name, &records[i].pr, &records[i].csalary);
}
you do not increment (i) in the...
Sorry your coding seems all C but you include the C++ specific header files and using namespace std.
Bet your wondering why no-one is replying.
Have a look at which forum this is. :)
Try the C++ forum.
cant remember ever reading Beginning C++, now Beginning C yes, but cant remember last time I picked it up though. :)
int rand_in_range( int hi, int lo ) {
srand(time(NULL));
return ((rand() % (hi - lo)) + lo);
}
You have a hi and lo number,
// subtract lo from hi (80 - 20 = 60)
// generate number in range up to difference (60)
random_num = rand() % (hi - lo);
// then just add the lo
random_num +=...
Yes if you set it up right.
// in complex.h
friend istream& operator>>(istream &input, Complex &c);
// in your cpp file
istream& operator>>(istream &input, Complex &c)
{
An example of the operator overload of the input istream operator.
// declaration in class file
friend istream &operator>>( istream &, Tester & );
// member defintion in cpp file
// i and j...
try it out then :) This maybe compiler specific, but if I remember correctly, setting the first elements to null will set the remaining elements to null on BB5.
if ( sex == m ) {
cout << "GO AWAY!!!" << endl;
}
else if ( sex == f ) {
cout << "Hey Baby ;).... call me!! " << endl;
You are trying to compare the input (sex) from the user for the...