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

are you sure ? I've done it hundreds of times without that problem. Probably some setting you have made in the editor.

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

>>am I doing something wrong?
Yes -- the std::string c++ class is not defined in string.h -- that header file declares C character handling functions such as strcmp() strlen(), etc. c++ strings are defined in <string> (without the .h extension).

#include <string>
using std::string;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the formatting is really horrible -- how did you get all those color code tags there? I just simply removed the code tags to make your code readable.

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

The structure should only hold the data for one month. Then create an array of these structures.

struct rainfall 
{
   double amount;
   int month; // 1 = Jan, 2 = Feb ... 12 = Dec
 } values[MONTHS];

Now after populating the array all you have to do is sort the array in descending order by amount.

void sortArray(struct rainfall array[MONTHS])
{
   bool swap;
   struct rainfall temp;
   int count;
   do
   {
      swap = false;
      for (count = 0; count < (MONTHS-1); count++)
      {
         if (array[count].amount < array[count + 1].amount)
         {
            temp = array[count];
            array[count] = array[count + 1];
            array[count + 1] = temp;
            swap = true;
         }
      } 
   } while (swap);
 
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What does that mean? return a void not a char, does that mean it should be void result(char, char, int&, int&, int&) ?

Please re-read my post -- I realized void was not right and made appropriate correction. Sorry if I confused you. :$

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

Also see this example and joe's explaination

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

looks ok to me except the function should return char* not char. See lines 13 and 14 below.

The rest is simple

int main()
{
  int player = 0;
  int computer = 0;
  int tie = 0;
  do {
    char userChoice;
    char compChoice;
    const char* msg;
    compChoice = getCompChoice();
    userChoice = getUserChoice();

    msg = result(compChoice, userChoice, player, computer, tie);
    cout << msg << "\n";

    cout << "User picked: " << userChoice << endl;
    cout << "Computer picked: " << compChoice << endl;

    
    cout << "User: " << player << endl
         << "Computer: " << computer << endl
         << "Ties: " << tie << endl;
  } while (doItAgain());
  return (0);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If I put your thumbnails side-by-side and look really really hard I can see one is slightly smaller than the other.

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

Just make the menu option the first character of the string that the client sends to the server. But I think that is what you already said. I have no idea what the remainder of that string will be.

>>and how it can be done using tab spacing ?
Huh? No idea what that means.

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

line 355 is missing a comma. Your compiler should have given you errors on that line. Never ever ignore compile errors or warnings.

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

create the function and pass the three variables (tie, player and computer) by reference to it.

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

who is that guy?

what guy? Rev. Al Sharpton? He's a jerk who likes to stur up racist trouble whenever possible. He and his supporters stood in the middle of the interstate (6-lane freeway, or autobahn as they call it in Germany) in St Louis a couple years ago to protest about something.

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

Obama is a Muslim fundamentalist, similar in his outlook on life (and how others should live it or more frequently not live) to that nutcase president of Iran...

I don't think being muslem will be in his disfavor. I recall people having similar fears about JFK in 1960 -- Don't vote for a catholic because the pope will be running the white house :S Turned out to be a completly false assumption and JFK did just fine as President, until of course when someone(s) shot him to death.

Obama, if elected, will have an even bigger problem -- he's black. I don't have a problem with that either, unless he continues sucking up to people like this.

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

i know the answer:
use:

#include<typeinfo>

and the operator typeid();

please provide example of use (or post a link).

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

how about lines 45 and 46?

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

Not generally -- you can use a union something like VARIANT structure in MS-Windows VB. But otherwise the function must already know the data type.

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

Sorry but we are not in the business of doing people's homework assignments for them.

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

The problem is line 30 -- it should look like this: choice = cin.get(); you also need to initialize hours to zero on line 12 because it can be used before initialized on line 71.

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

moved

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

we have already gone over this problem here.

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

You need to use fstream or ofstream to write to the file.

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

Hmm?

Yea, I was trying to compile it in a *.cpp file, which doesn't work. compiles ok as *.c

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

no it wasn't because there was no reason to delete it and the post is still there. -- and I tried another post with same results. Oh well, if I see it again I'll let you know.

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

post the code that you have tried.

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

you don't need the j loop. Just delete line 10 and increment it in line 14. Don't forget to initialize j in line 5.

[edit]Just like Fox showed[/edit]

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

seems to be working ok now. must have been some temporary quirk. But to answer your question, it happened when I initially clikcked on Add Rep link.

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

Can't add to anyone's rep points. I'm using IE7 on Vista Home

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

that program is pure nonsense -- it will not compile.

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

What kind of function

it doesn't matter -- just write a function and put all that print statements in it. That way you can call it as many times as desired or from any place. Writing functions is not difficult at all and makes your program a great deal simpler.

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

1. remove the else in that function. Each score must be tested and the else is preventing that from happening.

2. At the top of the function set LO to be initially the value of score1.

3. Why is LO a parameter to the function? Make it a local variable and return it at the end of the function.

int findLowest(int score1, int score2, int score3, int score4, int score5)
{
    int lo = score1;
    // other code here

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

I know of no way to do what you want with standard C/C++ libraries. You do have some options: I think boost libraries may help you, or you could save the data in strings and write your own functions to manipulate them. But I honestly don't understand the point of wanting to print out a number with 200 zeros :-O It might make your project look neat but it will be pretty meaningless -- who in his right mind is going to even attemp to read such a number -- it would take half a sheet of paper just to print it. Seeing 1.0001e+271 is a lot more understanding then something like this ungodly thing: 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

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

ConvertToInteger can be reduced to this:

void HugeInteger::convertToInteger()
{
   array1 = new int(strlen(a));
   for (int i=0;i<strlen(a);i++)
      array1[i] = a[i] - '0';
   
   array2 = new int(strlen(b));
   for  (int i=0;i<strlen(b);i++)
      array2[i] = b[i] - '0';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Karan: I really don't know VB that well, but don't you have to put the ip address in quotes?

ds.tables(0).rows(0).item(0)=ds.tables(0).rows(0).item(0).tostring.replace(ds.tables(0).rows(0).item(0), "http://172.13.15.65/test12/service.asmx")
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I agree with Salem -- it looks ok the way you have it. Putting it all on one line of code only saves band-width, paper and ink. Does nothing at all for the compiler or program speed.

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

so use realloc() to expand the 2d array to the desired size. Something like this untested code

// allocate first row
int **array = malloc( sizeof(int*) );
// allocate 6 columns
array[0] = malloc( 6 * sizeof(int));
int numRows = 0;
int n;
int row = 0;
int col = 0;
while( fread(fp,"%d", &n) > 0)
{
    if( col < 6)
    {
       array[row][col] = n;
       ++col;
    }
    else
    {
       ++row;
       array = realloc(array,row * sizeof(int*));
       array[row] = malloc( 6 * sizeof(int));
       col = 0;
       array[row][col] = n;
       ++col;
     }
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1. Don't try to do them all at the same time, but do them one at a time. Don't start on the second problem until you have finished the first.

2. Post the code that you have already written (and use code tags as explained here) , tell us what compiler and operating system you are using. Also post the first few error messages your compiler spewed out.

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

ok thats what I said... in here we can find same amount of words. But I dont want to find same word.. I want to find which one is first? I mean how can program recognize the john should be before than mary?? because it starts j which is before than m(mary)

If you only have two names then vijayan's previous answer will do. But if you have an array of names or structures then use the bubble sort previous mentioned (twice) to arrange the names in alphabetical order, then the first name in the list will be the name you will want.

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

strcmp() compares two strings and returns an integer that indicates whether string1 is less than string2, the same as string2, or greater than string2. For example

char string1[] = "John";
char string2[] = "Mary";

int n = strcmp(string1, string2);  // 0 return value means the two strings are the same

As vijayan mentioned the bubble sort is the easiest to code and use. There are hundreds of examples if you learn to use google. Just read any of these links.

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

It means you have declare the same sqlca object in both *.cpp files. If you want to use the same object in both files use the extern keyword in one of the two files, like this: extern struct sqlca sqlca .

You should use some other name for the object -- makes your program easier to read if you name objects something other than the name of the structure.

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

first, create the arrays of appropriate size. If you know the number of rows and columns in the file it will make it a lot easier. But if you don't (and normally you will not) then you will just have to dynamically allocate them with malloc().

Easiest way is to put it into one large array

// array to be allocated
int *array = 0;
int x = 0;
int y = 0;

// open the file for reading
FILE* fp = fopen("file","r");
// read x and y
fscanf(fp,"%d", &x);
fscanf(fp,"%d", &y);

// allocate the array
array = (int *)malloc(y * x * sizeof(int));

// read the data into the arra
int i = 0;
int maxi = x * y;
for(i = 0; i < maxi && fscanf(fp,"%d", array[i]) > 0; i++)
         ;
fclose(fp);

// now you can calculate the location of any x,y cell by this simple formula

int row = 5; // desired row
int col = 3;  // desired column
int cell = (<desired row number>-1) * <columns per row> ) + (<desired column number>)
or
cell = ((row-1) * x) + col;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved

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

you can use the compare method

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

the subject of this thread is confusion -- subject says win32 but you are using *nix os :-/ You can't use win32 api functions in *nix.

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

just add .0 after the const as in this example and it will be ok double microsoft=4294967295.0;

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

true -- strcmp() will compare the whole line, all you want to compare are the first two characters. strncmp() will do that. If you are writing a c++ program then you can use std::string's substr() method.

char line[] = "PH - Philippines: Smart, Globe(country's telephone operator)";

if( strncmp( line, "PH",2) == 0)
{
   // found it!
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what are the errors?

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

Post code -- I can't see your monitor because my eyes are not that good. ;)

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

strcmp() only works with NULL-terminated charqcter arrays -- it does not work with binary data or strings that are not null terminated.

Other than that, post your code to illustrate what you want to do.

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

not clear what a1 b1 c1 ... represents.

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

I would put it in another function then call it just before the getch() at the end of main().