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

Just convert the int to a string and add "0x" to the beginning of the string

int serial = 40000359;
char result[20];
sprintf(result,"0x%d", serial);

Or if you want to use only c++

#include <sstream> 
#include <string>
#include <iostream>

int main()
{
   int serial = 40000359;
   std::string result;
   std::stringstream str;
   str << "0x" << serial;
   str >> result;
   std::cout << result << '\n';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to use strcpy() to copy character arrays -- assignment operator doesn't work. strcpy(temp_last,record[j+1].last_name);

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

lines 12, 13 and 14 are in the wrong order. Move line 12 down below line 14, when the value of sizeOfArray is known. You have to do things in logical sequence -- first get the value of sizeOfArray from the keyboard and then allocate the character array of that size.

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

Read some of the links I posted. Most of the stuff in the Microsoft Windows SDK is unmanaged code.

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

You will probably have to rewrite all the text lines. Read the lines of the text box into an array of Strings, format the Strings the way you want them, then write the Strings back to the text box.

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

what version of VC++?

My guess is that you are writing a CLI/C++ program and Picture_viewer.h is using some unmanaged code. Here are some links that discuss that topic.

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

opendir() is used to begin reading the names of the files and folders stored in a directory. There is lots of information and examples around the net how to use it -- just use google. Here is one very good tutorial

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

Those are not pointers. Here is how you make an array of pointers to strings. With this, your program has only one variable name to contend with, not 12. char *no[]={"1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th"}; Once you enter a value 1-12 you can easily display the string using that index value, but first you have to convert it to a value 0-11 because the first element of any array is 0, not 1. Then you don't need that switch statement at all. Below is the only line you need. cout<<"It's the "<<no[num-1]<<" month and it's "<<months[num-1]<<"."<<endl;

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

What compiler are you using?

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

>> unresolved external symbol "int __cdecl inputData(class std::basic_string<char

That means you declared and called a function named inputData() but never coded the body of that function.

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

In mathematics, a rational number is any number that can be expressed as the quotient a/b of two integers, with the denominator b not equal to zero. Since b may be equal to 1, every integer is a rational number. The set of all rational numbers is usually denoted by a boldface Q (or blackboard bold , Unicode U+211a ℚ), which stands for quotient.

-- this wiki article

In C/C++ languages all int, float, and doubles hold rational numbers as long as they contain a finite number of digits.

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

look at the parameters for Shape::Check -- do they contain const keyword? t is const in intersect() so it can't be passed to a function whose parameter is not const. And yes, getting all those const straight is a pain in the behind :)

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

You need to change the class declaration too (probably in a header file).

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

hello friends actually i want to know which compiler is best suitable for gui development using c.please send the web adress to download that and send how to configure that.

It will depend on the operating system. As previously mentioned QT is good for cross patform.

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

use your compiler's debugger to step through the program and find out whay it crashes. I could make a couple guesses, but that's all it would be -- guesses.

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

>>but its also opening the source code of that exe file
The OP is most likely wrong about that. *.exe programs don't need the source code for its own program. When I compile Hello.cpp to create Hello.exe the *.exe file doesn't need Hello.cpp. It might need some other shared libraries or DLLs, but that's a different problem.

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

If you want to customize drawing of the edit control then you will have to cusclass it. I already gave you a link to one way of doing that. You can find other ones on www.codeproject.com, which has the largest repository of MS-Windows code on the internet.

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

Got to admit though -- doctors in USA can not prescribe marijuana for anything despite the fact that it has been proven to be usefor in cancer patients. Which brings us back to the topic of this thread.

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

what do you mean by "did not work" ??? We can't see your monitor.

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

>>I don't think conio.h is depraceted
As for C and C++ standards go -- no it isn't because it was never part of the standards in the first place. It's compiler specific. I suppose a specific compiler can declare something depreciated if it wants to (Microsoft has declared most of the standard C functions in string.h depreciated).

>>And how do you want to do clrscr() in standard c++?
There is no standard way to do it.

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

Of course -- I take several drugs prescribed by doctors to stay alive.

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

>>but my function should require a string, why it says the function need a char*???

because you just passed a pointer to a string. add() allocates memory for the pointer but since the pointer was not passed by reference main() never knows a thing about it.

You need to pass the string by reference, not by pointer. No allocation will be necessary in add(). And variable i is useless -- delete it.

void add(string& userInput, int sizeOfArray);


int main()
{
    char * cstr;
    char * p;
    string userInput;
    int sizeOfArray;

      cin >> sizeOfArray;

      add(userInput,sizeOfArray); //call function add

      
system("PAUSE");
return 0;

}

void add(string& userInput, int sizeOfArray)
{    
     
     char * cstr;
     char * p;

     for(int i= 0; i< sizeOfArray; i++)
     {
      getline(cin,userInput); //get a line from input
// what does getCommands() do ???
      getCommands(cstr,p);
      }
      

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

I still stand by what I said in my first post. MLK was jailed as a criminal for his civil rights stands. Jesus was killed for his radical teachings. In more recent events our jails are full of people who take or took drugs for recreational purposes.

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

The trailing const on a non-static member function means that the abstract (logical, externally visible) state of the object pointed to by this will not be changed by this member function. Where possible, the compiler enforces this rule. However, the const specifier does not promise that the physical state ("raw bits") of the object will never change.

Whew! All that gobbledegook to just say what I did in my previous post. Sounds like it came straight out of a text book :)

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

Too bad that isn't in English.

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

@tech9: Read the error message very carefuly -- it is telling you everything you need to know in order to fix the problem. You passed a std::string object, but the function requires char*. Now how do you correct that? Ask yourself how to convert std::string to char*. If you don't know then look at the online documentation for std::string, which as this one. Read through the list of methods and the descriptions for what they do and see if you can find one that does what you want.

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

just like I said

int a = 40;
int b = 3;
double intpart = 0;
double result = (double)a/b;
double fract = modf(result,&intpart);
int result = (int)fract*10; // convert 0.3333... to just 3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First check to see if you have to compile that library yourself, or does it already contain *.lib files that you need. Normally *.tar files were compressed from a *nix distribution, not MS-Windows. With Dev-C++ (which itself is ancient and outdated) you most likely will have to create a static library or DLL project and compile libiconv yourself, which is standard practice when working on *nix.

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

Then just use normal division (either float or double). After doing the divion you can call modf() to split the variable into integer and fractional parts. Certainly a lot easier to just use % operator.

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

the const keyword following a function declaration means the function will not change anything.

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

for the pointers you need just include <windows.h> There's nothing magical about it -- it's just the standard run-of-the-mill char pointer. Whether its char* or wchar_t* depends on whether you are compiling your program for UNICODE or not. If you don't need UNICODE for non-English languages then turn it off.

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

In the loop i+j requires the addition of i and j in order to resolve the index into pWord. That takes unnecessary clock cycles. Just simply continue to use the i counter that already contains the value that is needed in the loop.

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

what have you tried? The first two parameters to MessageBox do not ave to be string literals, they can be pointers to strings.

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

Or to avoid costly addition operations

for (j = 0; pTemp[j] != '\0'; j++,i++)
      pWord[i] = pTemp[j];
   pWord[i] = '\0';
vinitmittal2008 commented: useful info! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How do I expand and collapse this? I've tried the arrows to the upper right corner and nothing happens.

Just hit the Post Reply button

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

The mod operator is simply the remainder after division. For example, 4%2 is 0 because the remainder after 4/2 is 0. The mod operator works only on integers, not floats or doubles. There is no code to give you because that's all it is -- a simple 5th grade math operation.

[edit]And what ^^^ said.[/edit]

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

I once crashed the entire Unix operating system with a one-line statement: int* ptr = malloc(sizeof(int) * (MAX_INT_SIZE+1)); MS-Windows operating system today is pretty stable and won't allow a single program to crash the entire os. I haven't seen such a crash in quite a few years.

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

>>for (k = 0 ; k <= c ; k++)

Should be < c, not <= c.

>>I'm just unsure how to return the values from the structure with designating a matrix like this
The same as you would any other matrix return m->elements[r][c];

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

The best and simplest way to keep data private is to put the data on a flash drive (or usb drive) so that you can remove it from the computer when you are not working with it.

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

limits.h is part of your compiler. Just look in your compiler install folder.

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

You failed to read my other post in which I supported the civil rights movement of the 1960s. Read the whole thread before making such statements.

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

subclassing is a little bit like deriving another class from a base class. Assume you have a class named Animal and you want to make a class called Cat. In terms of MS-Windows controls that would be called subclassing and is done in C, not C++ (although you can use it in your c++ program as long as you use standard C syntax.)

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

Sadly, FolderSafe is not compatible with 64-bit Windows 7. I was going to install it on my computer to see how good or bad it is but it doesn't work.

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

max values are declared in limits.h

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

You could write it with c++ and use QT, which is a cross-platform GUI compiler.

benqus commented: thank you! =) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No -- he is saying he wants to hide the program from everyone except himself -- sounds pretty malicious to me. It's not even possible on MS-Windows because anyone with Admin privaledges can view every program in the system. Programs can not be hidden from Admins or antivirus programs, and for good reason.

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

>>because the compiler prints the
Don't blaim the compiler for the code you wrote :) The logic of your program is flawed.

scanf("%c" expects you to enter an alphabetic character, such as 'D'. The switch statement is checking for numeric data, such as 0, 1, 2, ... Since you used scanf( with %c that switch statement must check for the numeric values of the character, such as '0', '1', '2' etc. Note that using < and > doesn't mean much with that because, if you look at any ascii char you will see that there are NO characters < 0 and they are all > 0. Finallly, its ot possible to eter a negative value with %c.

Kamatari commented: Righto +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a list of the top 100 members that is probably more useful than the full list because the top 100 members will include most, if not all, the active members who post here. See the "Top Members By Rank" link the very top of the page.

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

When you compile a program the compiler generates the executable program that is usually self-contained except maybe for a few operating system shared libraries and DLLs. You can move the executable program any where you wish on your computer and it will normally run without problems. The source files (*.cpp and *.h) are not needed after they have been compiled. The compiler puts the exe file in the same folder as the source files only for your convenience.

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

Customizing the edit control can get pretty complicated. Here's one thread on that topic. Here are a few others.