|
How would I traverse an array testing each individual array member for equality to a char. Below is what I have so far but it says I can't use == with char and sting:
for(int x = 0; x <= input.Length; x++)
if(input[x] == " ") word_count++;
Thanks all
kha0s
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
If you change the " " to a single quote, ' ', then that should help with that. You should also change your <= to just < for the Length check. Arrays start with 0 and go to Length-1.
Steve Maier, MCSD MCAD
|
|
|
|
|
Ahh PERFECT it works, thanks a lot!!
kha0s
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
how exactly does the algorithm for finding all the permutations of a string work in C. For example, if you have a specified length, and you have an initial string, how would one calculate all the possible permutations of that string. Any examples would be greatly appreciated
|
|
|
|
|
do you simply want a total of all permutations, or do you want to display them too?
I think I remember doing a permutation problem when I was in college...use the factorial maybe? I'm not sure if that's correct or not, but if all you need is the number, that might be a place to start.
If you need to display all of the permutations, you'll probably have to use a stack.
This not only sounds like a homework problem, but it was also posted in the wrong forum, so I'm guessing you'll get more rude remarks than help in here...
|
|
|
|
|
Programs like SMS get the video from
a remote machine and allow you to interact
as if you were on that machine
I was wondering what I would need to look into
so I could write a program using C# that allowed
a user to do the same. I am guessing that the answer
to this question is not an easy one.
Any help would be great
thanks
Will
|
|
|
|
|
I use a simple ftp client code (that I've found on the internet) in my application.
The problem is that I can't receive the WHOLE response message from some ftp servers.
I've noticed that if the server response is short (one or two lines) it works fine (Socket receive(...) method is able to catch the whole response), but when the server response is a little bit longer (i.e. GuildFTP - three lines) - only first two lines are received.
Has someone noticed the same problem?
Many thanks for help in advance.
Socket client = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);<br />
IPEndPoint ipep = new IPEndPoint(Dns.Resolve(remoteHost).AddressList[0], remotePort);<br />
<br />
client.Connect(ipep);<br />
<br />
Byte[] buffer = new Byte[1024];<br />
<br />
client.Receive(buffer);<br />
<br />
MessageBox.Show(ASCII.GetString(buffer));<br />
|
|
|
|
|
Newbie question(still getting used to C#):
HTTP/1.1 500 Internal Server Error
Server: Sun-ONE-Application-Server/7.0
Date: Tue, 09 Nov 2004 16:58:28 GMT
Content-length: 8802
Content-type: text/xml; charset=UTF-8
Optimizable: true
Connection: close
[newline]
Message Here
....
....
I want to parse the message above so that I get the 'message' part of HTTP response, I am used to java, and I would normally use a 'split' function, does this exist in C#, a split, the result is stored as a String
Berlin Brown
GIS Developer
http://www.retroevolution.com
|
|
|
|
|
Don't know if that's what you're looking for, but i'll give it a try
Take a look at the String class which offers many methods for string manipulation, e.g. the Split method.
www.troschuetz.de
|
|
|
|
|
I should have figured that, just checking, I was going to split it, then check for a zero length or 1 length string.
Berlin Brown
GIS Developer
http://www.retroevolution.com
|
|
|
|
|
|
:In c++ there is a function :"_i64toa" ,it can encoding "long" to "char" ,Is there any function in c#.net can do it like "_i64toa"?
Need you help, thanks!
|
|
|
|
|
|
Look in the documentation at the System.Convert class. This object has all sorts of functions to convert. There is an overload in there that will convert long structure data to char structure data assuming that is really what you wish (keep in mind char in the CLR is 16 bit, unicode character data type and long is 64 bit integer).
|
|
|
|
|
and save yourself some cash.
1. This forum is for C#, not C.
2. Pick up a book and read it, get glasses so you see the differnce between C & C#. You will likely see a similar example of what is required of you.
3. No, we dont do your homework, thats your job, why are you taking this course anyways, if you dont want to learn?
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
While I agree with leppie to an extent, I still hate to not help somebody coming in here with questions...
I haven't used c in a while, so I might be a little off, but you should get the idea from this (you'll probably need to check the include libraries, not sure where IsAlpha( char ) lives)
you've already declared your input, which you called imput, with a length of 100...so let's just go from there.
char imput[100]="interesting, this class of robotics";
int iLowerBound, iUpperBound;
for ( int x = 0; x < 100; x++ )
{
if (isalpha( imput[x] ))
{
iLowerBound = x;
while (x < 100 and isalpha(imput[x]))
x++;
iUpperBound = x-1;
for ( int y = iUpperBound; y >= iLowerBound; y-- )
printf("%c",imput[y]);
}
printf("%c",imput[x]);
}
I didn't test this, and really have no clue if it works...I just wrote it off the top of my head in about 5 minutes. Assuming it does work, this should be about all you need. Hope it helps...
|
|
|
|
|
what is the code I would use to, say, run a file called "hello.txt" in c:\documents\hello.txt
if I get this, I can figure out how to open the other files I need to
|
|
|
|
|
I'm a bit confused Do you want to run or open files?
In first case take a look at the Process and ProcessStartInfo classes and in second case look at the System.IO namespace.
If that doesn't help, please be a bit more specific.
www.troschuetz.de
|
|
|
|
|
sorry, I need to be able to simply execute a file. also, while your reading this, how do I uninstall a program that is registered in the control panel, but doesn't come with an uninstaller. I mean, is there a way to "open" the control panel and remove the program with that through code. How would I go about doing that?
Danke Schon.
|
|
|
|
|
"sorry, I need to be able to simply execute a file":
As I stated in my previous posting take a look at the Process and ProcessStartInfo classes. The appropriate MSDN topics provide some examples, so you should have no problems with that. Otherwise let me know what concretely doesn't work.
"is there a way to "open" the control panel and remove the program with that through code":
As far as I know the list of installed programs that is accessible through the control panel is based on information inside the registry. So to "uninstall" the program you'll have to remove the right registry entries, which is possible in .NET (RegistryKey and Registry classes). But please don't take this for granted as havn't much experience in this field and maybe start a new thread with this particular problem.
www.troschuetz.de
|
|
|
|
|
I am a student of a c programming class in Texas. Our teacher is one that does not assist all that much but chooses to leave us to our own devices in programming his projects. That said, i am asking for any assistance that may be given in helping me write a program that
"can reverse the characters in a word, but leave it in its original position in the sentence"
Heres what ive coded so far:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char imput[100]=" interesting, this class of robotics";
char list1[30][50];
char databank[50];
int i=0;
int j=0;
int k=0;
while(j<30){
j++;
while(k<50){
k++;
list1[j][k]=0;}
}
while(imput[i] !=0){
if (imput[i]=32){
j++;
k=0;
i++;}
else{
list1[j][k]=imput[i];
k++;
i++;}
}
for (k=0;k<60;k++){
for (j=0;j<30;j++){
printf("%c",list1[j][k]);
}
}
i=0;
while(i<30){
databank[i]=0;
i++;}
for(i=0;i<60;i++){
while(list1[j][k] !=0){
databank[i]=list1[j][k];
i++;
k++;
if(list1[j][k]=32){j++;}
}}
i=0;
while(i !=20){
printf("%c\n",databank[i]);
i++;}
// j--;
// k=0;
// while(j>-1){
// list1[j][k]=databank[j];
/// j--;
// k++;}
// }
// for (k=0;k<60;k++){
// for (j=0;j<30;j++){
// printf("%c",list1[j][k]);
// }
// }
system("PAUSE");
return 0;
}
Our next project is to sort a list of integers in ascending order, ill happily accept any help offered on either of these projects.
Thanks
Bill
|
|
|
|
|
Hi, Im using directx9 to show an .avi movie in a picture box. The movie is copy file movie that comes with visual studio in ...Microsoft Visual Studio .NET\Common7\Graphics\videos folder.
This movie has a pink or magenta background, I want suupress it to show the picturebox bakground color.
I have try many things but I cxant do it.
system.drawin.bittmap has a methos makeetransparent with a color in pareamete. I neeed an similar method for Microsoft.DirectX.AudioVideoPlayback.Video class.
How can I do that?
Thank you, Luis Ruiz
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I don't think it's that easy. How do you know the color of a specific pixel? if you can read it you probably can overwrite it.
try reading this[^]
there are no facts, only interpretations
|
|
|
|
|
Ladies & Gentlemen
I have two issues when dealing with windows forms data binding.
1-I have created a windows form . And on it I have added tab control which has other controls .
I f I create a method to clear all controls on the form of data. Only controls on the tab that has focus are cleared of data. others remain uncleared and especially ComboBoxes.
How can I write a method to clear my form after data entry.
2-Second issue ,I have employee details. I have Banks and Each bank has branches. I want to create ComboBox that list all Banks and this should be linked to Branches ComboBox and the branches comboxBox should have its SelectedValue pointed to employee data row. That is it should make the look up table containing bank branches form employee data.
Meaning that if an employee has his account with ABC bank ,it should also specify the branch. That is I have a list of branches for each bank.
How can I implement this lookup hierarchy.
Amour Rashid Hamad
P.O.Box 9294
Directorate Of Information Services (TTCL)
Dar Es Salaam
Tanzania
|
|
|
|
|
Hi
How i can retrive an resource (Bitmap for handle) from my project.Before now i handn't experince with .Net resorces
and i anticipate this in the same way like in MFC projects, but there is no resource files, and i just add my bitmap inderectly to project(Project->Add New Item->Bitmap)is it correct? .And now i want to get the bitmap ID from my code.
Where is a way to do so??
Thank.
|
|
|
|