CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: ostringstream

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    78

    ostringstream

    so i have this code that i had used in c++, but i don't know what i should i use in java...
    Code:
    	public String getStringMessageID()
    	{
    		ostringstream temp;
    		temp << messageId;
    		return temp.str();
    	}
    These are the errors for the above:
    ostringstream cannot be resolved to a type Assignment 10/src Messages.java line 114 1209617205928 8023
    Syntax error on token "<<", invalid AssignmentOperator Assignment 10/src Messages.java line 115 1209617205929 8024


    I also have another error which i dont know what to do about, but would love some help on
    Code:
    	static void sortArray(Message msg[], int size)
    	{
    		Message temp;
    		boolean swapped = true;
    		int count = 0;
    		for(int index = 0; index < size && swapped; index ++) 
    		{
    			swapped = false;
    
    			for(int i = 0; i < (size - 1) - count; i ++)
    			{
    				if (msg[i].getDate() > msg[i + 1].getDate())
    				{
    					swapped = true;
    					temp = msg[i];
    					msg[i] = msg[i + 1];
    					msg[i + 1] = temp;
    					
    				}
    			}count ++;
    		}
    	}
    Here is the error i get for this one:
    The operator > is undefined for the argument type(s) java.lang.String, java.lang.String Assignment 10/src Mailbox.java line 90 1209618068710 8102


    If you would like to see the rest of the code just let me know and i will post it
    Last edited by zhbcool; May 1st, 2008 at 12:25 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured