|
Do you want to arrange arrays in ascending order? Or do you want to arrange the items in an array in ascending order?
Try to work some on the clarity of your question.
---
single minded; short sighted; long gone;
|
|
|
|
|
sinji_solanki wrote: how do we arrange them in ascending order..
By using a sort algorithm.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
If you want to place a threat for every question of your homework.
Don't go on!
Place them in one question, so we only need to downvote this rude behaviour once!
All the best,
Martin
|
|
|
|
|
The technical term for that is: sorting.
You may want to read up on the Array class, maybe it has some kind of sort method...
|
|
|
|
|
I think you have to populate them in ascending order
|
|
|
|
|
|
Do you have a question?
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: Do you have a question?
He probably does, but it's a homework question.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Colin Angus Mackay wrote: He probably does, but it's a homework question.
It looks like a homework assignment to me. Not a question at all.
---
single minded; short sighted; long gone;
|
|
|
|
|
sinji_solanki wrote: enter a number and display next 5 prime numbers.
You should attempt your homework questions yourself. If you get stuck post the code and we'll help you out. However, we ain't gonna do it for you.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
bool finished = false;
while(!finished){
Console.WriteLine("Please enter a number: ");
string startNumber = Console.ReadLine();
if(startNumber == "1"){
Console.WriteLine("2 3 5 7 11");
finished = true;
} else {
Console.WriteLine("Please enter \"1\" instead");
}
}
Enjoy your A+!
|
|
|
|
|
PhilDanger wrote: Console.WriteLine("Please enter \"1\" instead");
|
|
|
|
|
Beautiful!
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Marvellous.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
sinji_solanki wrote: enter a number
2.
sinji_solanki wrote: and display next 5 prime numbers.
3, 5, 7, 11, 13
Ok. Now what?
|
|
|
|
|
You have conquered this level.
You now move to the next level:
Enter a 10-digit integer number consisting of odd digits only, and write a program
to print the next 5 primes.
|
|
|
|
|
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Shame on you.... Go do you own homework, if you have a specific problem with your homework, such as why something isn't working as you expect, then ask a question. But don't expect people to do your work for you. It won't get you far in the industry.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
I am creating a custom membership provider, one of the properties I had to override as follows:
public override bool EnablePasswordReset
{
get { return m_EnablePasswordReset; }
}
In my Initialize method I have to go and set m_EnablePasswordReset. I don't like setting private variables without using a property. Why can't I add a setter in this property like:
public override bool EnablePasswordReset
{
get { return m_EnablePasswordReset; }
set { m_EnablePasswordReset = value; }
}
I hope someone can help.
Regards
ma se
|
|
|
|
|
you can if there is a virtual property with both a get and a set part in the base class.
that's what the error message should indicate (I guess it is: "no suitable method found
to override")
|
|
|
|
|
Of course it depends on base class property declaration.
BTW
public virtual bool EnablePasswordReset;
{
get { return m_EnablePasswordReset; }
}
defines a read-only property, maybe the base class author considered a bad thing allowing public write access to the variable.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I write a function that passes a string parameter to my ws and return the hash code of that parameter.
But when I compare it to the hash code of the original string in my client-side code, they were not equal.
Could anybody help me please?
WS Code:
[WebMethod]<br />
public int MyWebFunction(string data)<br />
{<br />
int retVal = data.GetHashCode();<br />
<br />
... rest of my code ...<br />
<br />
return retVal;<br />
}
Client-Side Code:
public bool DataUploader(string data)<br />
{<br />
bool retVal;<br />
int hashCode;<br />
<br />
MyWebService ws = new MyWebService();<br />
hashCode = ws.MyWebFunction(data);<br />
<br />
if (hashCode == data.GetHashCode())<br />
{<br />
retVal = true;<br />
}<br />
else<br />
{<br />
retVal = false;<br />
}<br />
<br />
return retVal;<br />
}
Why does it always returns false?
I'll make sure they remember my name a hundred years from now!
|
|
|
|
|
There are two possibilities:
- the strings are NOT equal.
- the hashing is different; please read the remarks on MSDN about String.GetHashCode()
|
|
|
|
|
Apparently the string is the cause of my problem.
Using the same web method, I run these codes which return two different results.
Returns true:
public void DoUpload()<br />
{<br />
string data = "This is my string to upload.";<br />
<br />
UploadData(data);<br />
}
Returns false:
public void DoUpload(string cmd, string conn)<br />
{<br />
DataSet ds = new DataSet();<br />
OleDbDataAdapter oAdapter = new OleDbDataAdapter(cmd, conn);<br />
<br />
oAdapter.Fill(ds);<br />
<br />
string data = ds.GetXml();<br />
<br />
UploadData(data);<br />
}
How could that happen? What's the difference between those two string?
I couldn't find any reason why the first code returns true while the other returns false...
I'll make sure they remember my name a hundred years from now!
|
|
|
|
|
Hi,
GetXml() returns a structured text with < and > signs and everything,
it will not return "This is my string to upload."
I am not familiar with databases nor XML, but I think we established your
two strings ARE different. You should have looked at the strings themselves
in the first place !
|
|
|
|