Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

*sign* blasted again :'(

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>how does long and long long differ?
long was originally intended to be 32 bits and long long to be 64. These are the minimum limits though, so as the need for longer types grows, they could grow to accommodate it.

>Was short type ever was 1 byte and changed to 2 bytes later on?
No, short has always been at least 16 bits.

>Was long and int ever was 4 byte and 2 bytes respectively?
The minimum for long is 32 bits, and the minimum for int is (surprisingly to some) 16 bits. So you could say that long is at least 4 bytes and int is at least 2 bytes presently (assuming an 8-bit char type), but could be more depending on the implementation.

According to this article you are wrong (gasp!), and I seem to recall you saying the same several times in the past.

The size and range of any data type is compiler and architecture dependent.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The variable b in main() is passed to function abc() by reference, which means that any changes made to it in abc() will also be made in main(). The parameter x in abc() is a pointer to the variable b in main().

So if you want to print the value of x that is in abc() just print the value of b that is in main(). Even though they have different names, since x is a pointer, printing the value os *x is the same as printing the value of b. Clear as mud?

Add a line of code in abc() to print the value of x and you will see what I mean: printf("x = %d\n", *x); Note the star is required because x is a pointer.

Xufyan commented: great :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The same C program with vc++ 2008 express does not have that problem. Maybe I'll report it to Symantic.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>float main(void)

main() does NOT return float -- only returns int

float abc(float *x)
{
   float p;
   scanf ("%f",x);
   p=*x* *x;
   return(p);
}

int main()
{
   float a,b;
   a = abc(&b);
   printf("a = %f\nb(x) = %f\n", a, b);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Guess what? HelloWorld with Code::Blocks and MinGW (Windows 7)also produces a virus warning from Norton Antivisus :icon_eek: Had not noticed that before because I never tried to compile and run it. I'v tried adding a couple more lines and even changing the name of the executable, but it won't run. When run from the command prompt it runs ok. So must be something with the IDE.

[edit]The c++ version of Hello World compiles and runs without a problem. Wonder why the C version doesn't run?

prade@ Create a c++ Hello World with Dev-C++ and see if that runs without error.[/edit]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The size of data types is mostly compiler dependent. See limits.h for sizes and maximum values.

>>Was short type ever was 1 byte and changed to 2 bytes later on?
Not that I know of, but could have been depending on the compiler.

>>How to specify long long int and long long double (does it exist?) in printf and scanf?

long == "%ld"
long long == "%lld"
double = "%lf"
long double = "%llf"

AFAIK there is no such thing as long long double, but I suppose there could be on some 128-bit machines.

>>Which data types among char, int, long, float, double has the same size different platforms?
All of them. C/C++ standards do not dictate the size of variables (except char is guaranteed to be 1). only that char <= short <= int <= long <= float <= double. So I suppose they could all the the same size on some platform.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably should be form2->ForwardVariable= "dummyString";

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for binary search algorithms.

[edit]Oops! Didn't see firstPerson's response.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What are the primary differences between wireless voice and paging systems.

One has wires and the other doesn't ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

probably because you didn't include code to keep the window open

printf("Hello World\n");
getchar();  // wait for you to press the Enter key
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hint: The return value to a is undefined because the function doesn't explicitly return a value. Also, most modern compilers will produce errors on that code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No one here is going to write your program for you. You should have started on that at least a week ago if it's due tomorrow. So much for your procrastination.

The assignment seems pretty clear to me. Do you know how to create a class? No, then study your textbook.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is how I did it in MFC (have not used managed CLR but it might be the same). In Form2 create a public variable that holds whatever you want to pass it, then in Form1, just after gcnew line, set the value of the variable. Once Form2 starts it can move the value of that variable anywhere it wants, such as in edit box or somewhere else.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the files are small enough why not just copy to 5 1/4" floppy diskette? Then copy then onto the XP file system. You might also be able to create a LAN and copy them directly.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You forgot to include [sarcasm] and [/sarcasm] tags :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I do, I eat the whole lot, stalks and all. Started when I was taken on long drives in my dad's new car. You daren't put the spent cores anywhere, so ended up eating them. I quite like them now. I still get some funny looks mind you.

Well, that explains a lot about you and your weird-looking avatar.:) Why didn't you just open the window and toss the cores out ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

... when you recall watching Rowan & Martin's Laugh-In

I loved that show -- soooo funny. :) Almost (but not quite) as good as Benny Hill.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>*(float*) variable = 34;

It is typcasting variable into a float *, then assigning the value 34 to it.

DWORD* is doing something similar to above. DWORD is defined by Microsoft's windows.h to be unsigned long;. So its the same as (unsigned long *)

I've studied MFC a lot and have never seen this: If it exists, please tell us where you found that. Maybe some very very old 16-bit code?

#define variable 0x00CB11C8
(some variable/pointer) = (DWORD*)variable
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No. But there is a win32 api function that is called. VS 2005 is nothing more than a compiler and IDE.

I think something in this link will help you

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at those two lines and see if you can't figure out what is wrong with them. Read the error messages carefully because they tell you exactly what is wrong.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
struct item
{
    string name;
    float price;
};


int main()
{
    item it[] = {
        {"Fried Chicken",12.99F},
        {"Pork Chops", 10.99F},
        {"Soda", 2.99F}
    };
    for(int i = 0; i < sizeof(it)/sizeof(it[0]); i++)
    {
        cout << setw(20) << left << it[i].name 
            << setw(5) << right << it[i].price << '\n';
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would think it would be better to implement the queue as a linked list so that it can contain an (nearly) infinite number of items in the queue.

tux4life commented: Yes. +8
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Under MS-Windows the only way is to call CreateProcess() to launch the console program. One of that function's parameters will tell it to create the process without a console.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not likely to keep the path or filename because it is only needed to pass along to the operating system so that it can open the file and return the handle to fstream. You could subclass fstream so that it saves that information.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>please check this script

Why? Check it yourself by compiling and running it. We are not your compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i have my submissions today n just want to know basics.

Are you a member of the Procrastinator's Club. Apparently so because now is a hell of a time to start the program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You want to use win32 api EnumWindows

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I have just recently read over the rules.
It's about time. But better late than never :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use '\r\ to move the cursor back to the beginning of the current line so that you can print some other text, e.g. printf("\rHello");

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why not? I use it in windows 7.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>void writeIteratively (ostream& outfile)

That function does not have a this pointer because its not a member of a c++ class. Maybe you meant void BinarySearchTree::writeIteratively(...);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>hv no time to read dat help topics..

Then go watch TV of play some video games. The same site you download the compiler has a tutorial. Go read it and stop being so childish.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post code and this time use code tags

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

char stringArray[N][MAX_STRLEN];

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> string tscore[26]={};
You don't need to create an array of std::string objects. Just one will do, such as std::string tscore; This code will give you one string with embedded '*' s. Note that you will have to add code that prevents the last '*' from being in the string.

cout << "Your name is: ";
for(int i = 0; i < name.size(); i++)
{
    tscore += name[i];
    tscore  += '*';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at line 30 of the code snippet you posted. See -- it has one parameter. Now look at line 23 ... there is no parameter. That's what the compiler is complaining about. You need to pass by reference the object you want to subtract.

You need to create another FancyDateClass object and pass that as the parameter. And delete line 31 -- that should be done when you create the FancyDateClass object in main. Better still you should get the current date and initialize FancyDateClass object with that instead of hard-coding some fictitious date.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Think about it, then try to write the problem yourself. Post YOUR code with whatever question(s) you may have. Please deposit $10,000.00USD in my PayPal account and I'll write that for you :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

curses is not related to conio.h. From wiki

The first curses library was written by Ken Arnold and originally released with BSD UNIX, where it was used for several games, most notably Rogue. [2] [3] [4]

The name "curses" is a pun on cursor optimization.[5] Sometimes it is incorrectly stated that curses was used by the vi editor. In fact the code in curses that optimizes moving the cursor from one place on the screen to another was borrowed from vi, which predated curses.[3]

curses was originally implemented using the termcap library.[citation needed] A few years later, Mark Horton, who had made improvements to the vi and termcap sources at Berkeley, went to AT&T and made a different version using terminfo, which became part of UNIX System III and UNIX System V. Due to licensing restrictions on the latter, the BSD and AT&T versions of the library were developed independently. In addition to the termcap/terminfo improvement, other improvements were made in the AT&T version:

<snip>
Notes
1. Thomas E. Dickey. "NCURSES - Frequently Asked Questions". http://invisible-island.net/ncurses/ncurses.faq.html.
2. Peter H. Salus (October 1994). "The history of Unix is as much about collaboration as it is about technology". Byte. http://www.byte.com/art/9410/sec8/art3.htm.
3. a b Arnold, K. C. R. C. (1977). Screen Updating and Cursor Movement Optimization: A Library Package.. University of California, Berkeley.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And it's not dependent on the operating system. It depends on the compiler.

Pick on AD day ??? It will actually depend both on OS and compiler. AFAIK *nix can't support the functions in conio.h, but I suppose someone could write a vt100 version or one that uses termcap.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
char value1[10]="new york";
char value2[9]="st louis";
char result;
v1=&value1[0];
v2=&value2[0];

All those lines are in the wrong function. Mystrcmp() needs to compare the two strings that are the parameters to the function.

int main()
{
   char value1[]="new york";
   char value2[]="st louis";
   int x = Mystrcmp( value1, value2 );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is there something wrong with the code? You don't need to call endl but rather do like this: cout << a << "\n\n";

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When the elements of the array are moved (or copied) up a slot that will overwrite whatever was there before. That does not make the arrray smaller, it just means the last array element is left empty, or unused.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google always works for me :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

seems to work is misleading. scanf() will scribble all over memory when you type more than 15 characters. The solution is to either use getchar() or scanf("%15s"); But with scanf() you will not know whether there are more keys or not in the keyboard buffer.

int c;
int i = 0;
while( (c = getchar()) != '\n')
{
    word[i++] = c;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Umm so any solution? I want to specify the directory and name of file using the code.

Any ideas?

I already told you the solution. Pay attention.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I finally got it to compile with vc++ 2008 Express. Get this warning on function read_skinning_info() which you can not just ignore

warning C4172: returning address of local variable or temporary

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Try a little redesign of the program by removing all those static objects and pass them by reference into the functions, such as void load_character(Character& ret) Your program will use less memory that way too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How to fix the problem, please?
what problem?? CopyFile() parameters are const char*, not std::string. Call string's c_str() method to make the conversion.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Looks like what you really want is to convert that string into an integer then write the binary value of the integer. See this link for more info about strtol()

char num[] = "01011";
char* ptr;
int x = strtol(num,&ptr,2);
out.write((char*)&x,sizeof(int));