Anybody know what the diff is between _tmain() and plain old main()? Where can I read about it? obviously I haven't been too successful finding anything.
Thanks
Type: Posts; User: rc7j
Anybody know what the diff is between _tmain() and plain old main()? Where can I read about it? obviously I haven't been too successful finding anything.
Thanks
This as an incomplete answer but might help.
#define is a preprocessor facility used in C to define constants and macros among other things. The preprocessor goes through the source file and...
That error checking is great. I will put it in my program. Thanks
I used the following code to check it. THey are floats in the end.
cout << sizeof(float) << "double" << sizeof(double) << " element " <<
sizeof(ary2Sort[0]) << endl;
THe output was...
Thank you. The program does run fine.
I can't get cin to take a type float from the keyboard. I am entering them into an array with a for loop but when I put an 'f' at the end to indicate a type float I get kicked out of the loop. If I...
That works. Thanks.
is it possible to use a function call as a case argument in a switch statement?
Ex.
switch (ch) {
case isdigit(ch): /* runtime error 'not a constant' */
...
How do I type cast a pointer to void so I can use it in a loop?
void *smMacroPtr;
for(fooPtr = (int *)foo; fooPtr < (int *)(&foo+1); ++fooPtr, ++((int*)(smMacroPtr)))
if (smMacroPtr !=...
The function call: " printAverage(dArray);" produces an error. The Visual c++ error message is: "cannot convert parameter 1 from 'double [3][2][5][2]' to 'double'"
'dArray' in its decayed form...
That is where the error is. SB: #define elements(array) (sizeof(array)/sizeof(double))
why does the line: "cout << elements(dArray);" in main() produce a compiler error saying "type 'double' unexpected"? I am using Visual C++.
#include <iostream>
#include <cstdlib>
using...
Got it, thanks. It compiles OK.:cool:
anyone know how to -
"type cast to a pointer to a pointer to an array of 3 floats"?
I came up with -
float (**(type cast))[3];
What goes in the type cast parins?
This is supposed to...
Why does the 'getline(cin, ownerName);' and the 'cin >> ownerName;' cause the user to be kicked out of the program. It continues to print the 'cout' statements but allows no more input.
#include...
try -
if (type == "presidential")
more stuff
also you could use a switch statement here.
That's the book. no cd-rom. source code for examples in the book are supposedly on the internet at http://www.brookscole.com/compsci/bronson/cpp
I haven't been there.
thanks. that works. Now how do I allocate space without specifying the length of the string - like making a ragged array? ref. the '*name' pointer in the struct definition.
The following code sets up an array of structures that is partially populated. one of the members is a pointer to a string (lunch[i].name). How do I populate the rest of the structure by user input?...
"A First Book of C++" by Gary Bronson was my first textbook. It has a lot of exercises and answers to the odd number question.
Thanks you all for your help. I got the program to work.:)
thanks, I tried both suggestions, same results. Must be somewhere else?
#include <iostream>
#include <cstdlib>
using namespace std;
float lowestSales(float *salesTotAry, int salesPer);
...
lowestSales(salesTotAry[0], salesPer);// function // call does not evaluate to a function
// The function is:
float lowestSales(float *salesTotAry, int salesPer)
the perameters match up
??
Thanks, this code works with one exception.
The output for:
if (s1 < s2)
return -1;
if (s1 > s2)
return 1;
is backward.
EX: s1="a" compared to s2="B" shows a < B.
Using...
Thanks. This code will compile but produces a runtime error
/*This program uses a function to compare strings
*/
#include <stdio.h>
int myStrcmp(const char *s1, const char *s2);
int...