|
Hi,
I am creating a Process in C# and want to print my "strName" value to command prompt.
This code is not printing any value , please let me know the right code.
I know this code is wrong,,but if we pass Arguents then?
string strName = "Alex";
Process pr = new Process();
pr.StartInfo.FileName = "cmd.exe";
pr.Start();
Thanks
modified on Friday, April 9, 2010 10:14 AM
|
|
|
|
|
Have you tried going into the project properties and building it as a Console Application? Then just do:
Console.WriteLine(strName);
|
|
|
|
|
I am trying to do with process.
|
|
|
|
|
Using this code , and where to add new line of code which prints value to commandprompt.
string strName = "Alex";
Process pr = new Process();
pr.StartInfo.FileName = "cmd.exe";
pr.Start();
|
|
|
|
|
Ok, if you want to actually send commands to the prompt, as opposed to just outputting text, you can do that via standard input...
pr.StartInfo.FileName = "cmd.exe";
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.RedirectStandardInput = true;
pr.Start();
pr.StartInput.WriteLine(strName);
Of course, "Alex" isn't a command, so this is just going to give an error.
If you're trying to do something else, you're going to have to be a little more clear, because your question is rather vague.
|
|
|
|
|
|
please i need the complation of 4 queen only by my code for my doctor
we start
desgin from
node class
bfs class
to top expirt
please try to find by this method in simple code
by use my class and add to classes the miss code
form has two buttons
and grid 4x4
picture here
http://yfrog.com/0s91807548j[^]
class Node
{
public bool[,] state { set; get; }
public Node parent { set; get; }
public List<Node> childs { get; set; }
public int level { get; set; }
public int Hfunction()
{
int res=0;
return res;
}
public void generate_child()
{
for (int i = 0; i < 4; i++)
{
bool[,] newstate = (bool[,])this.state.Clone();
Node child = new Node();
childs.Add(child);
child.parent = this;
child.level = this.level + 1;
newstate[child.level, i] = true;
child.state = newstate;
}
}
public bool visited { get; set; }
public Node GetBestChild()
{
int Min = int.MaxValue;
int min_index = -1;
Node BestChild = null;
for (int i = 0; i < 4;i++ )
{
int CurrentValue = this.childs[i].Hfunction();
if (CurrentValue < Min && this.childs[i].visited == false)
{
BestChild = this.childs[min_index];
BestChild.visited = true;
Min = CurrentValue;
min_index = i;
}
}
return BestChild;
}
class BFS
{
public Node BfsProcess(Node root)
{
Node soultion = null;
if (root.Hfunction() == 4)
{
return root;
}
else {
root.generate_child();
Node bestchild =null;
while ((bestchild = root.GetBestChild()) != null)
{
soultion = BfsProcess(bestchild);
}
return soultion;
}
}
}<pre>
<div class="signature"><div class="modified">modified on Friday, April 9, 2010 10:39 AM</div></div>
|
|
|
|
|
What a $hit question, can't see many helpful response coming your way!
Oh, and yes, you got a 1 from me.
Go read the sticky posts at the TOP OF THE FORUM, to see how to ASK A QUESTION PROPERLY
|
|
|
|
|
amrreko wrote: please i need the complation of 4 queen only by my code for my doctor
Damn!
Watched code never compiles.
|
|
|
|
|
amrreko wrote: please i need the complation of 4 queen
How many queens? 8 is the usual number.
amrreko wrote: only by my code for my doctor
Is this a medical emergency? Use TCP
amrreko wrote: we start
desgin from
node class
bfs class
to top expirt
nice hiaku.
amrreko wrote: please try to find by this method in simple code
by use my class and add to classes the miss code
What code? You haven't included any. I don't normally respond so sarcastic a way, but you haven't specified the problem, the question is unintelligible, you haven't said what you have done and you obviously haven't tried to do this yourself. We aren't going to do your homework for you. I suggest you read the FAQs.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Aww, go easy on him...
Keith Barrow wrote: amrreko wrote:
we start
desgin from
node class
bfs class
to top expirt
nice hiaku.
The proper pattern is 5-7-5. He just needs a couple more syllables... I'm sure we could make this work.
You have to be patient with these guys... If they don't speak English as a first language, it's difficult to make a proper haiku.
|
|
|
|
|
How come you go univoted . Upvoted to fix...
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Writing a Haiku
Difficult in Japanese
Moreso in English
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
class Node
{
public bool[,] state { set; get; }
public Node parent { set; get; }
public List<Node> childs { get; set; }
public int level { get; set; }
public int Hfunction()
{
int res=0;
return res;
}
public void generate_child()
{
for (int i = 0; i < 4; i++)
{
bool[,] newstate = (bool[,])this.state.Clone();
Node child = new Node();
childs.Add(child);
child.parent = this;
child.level = this.level + 1;
newstate[child.level, i] = true;
child.state = newstate;
}
}
public bool visited { get; set; }
public Node GetBestChild()
{
int Min = int.MaxValue;
int min_index = -1;
Node BestChild = null;
for (int i = 0; i < 4;i++ )
{
int CurrentValue = this.childs[i].Hfunction();
if (CurrentValue < Min && this.childs[i].visited == false)
{
BestChild = this.childs[min_index];
BestChild.visited = true;
Min = CurrentValue;
min_index = i;
}
}
return BestChild;
}}
<pre> class BFS
{
public Node BfsProcess(Node root)
{
Node soultion = null;
if (root.Hfunction() == 4)
{
return root;
}
else {
root.generate_child();
Node bestchild =null;
while ((bestchild = root.GetBestChild()) != null)
{
soultion = BfsProcess(bestchild);
}
return soultion;
}
}
}
|
|
|
|
|
It's normally identifies as the 8 queens problem and you need to perform a breadth first search. Try this[^] link.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
amrreko wrote: please i need the complation of 4 queen only by my code for my doctor
Is your Doctor a psychiatrist?
amrreko wrote: we start
We sure do, as an ova then the sperm initiates mitosis...etc.
amrreko wrote: desgin from
Alexander McQueen perhaps?
amrreko wrote: node class
YEah, gotta learn about them nodes, I attended one once, I am expert nodologist!
amrreko wrote: bfs class
BFS Class? Well, I suppose if you want to be a British Fertility Society, it would help if you learnt about that Ova/Spern thing.
amrreko wrote: to top expirt
You are going to murder an Ex Pirt? Kill a current Pirt instead!
amrreko wrote: please try to find by this method in simple code
I tried, but there aren't enough letters in the clue.
amrreko wrote: by use my class and add to classes the miss code
Well, if your young female teacher finds you being bad, she will add to her class, that is her code.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
This is for your doctorate? You can't string 2 coherent words together: how on earth do you expect to understand the answer if no one can begin to guess at what the question might be? One from me as well.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
I think you'll find this[^] link more than useful.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Brilliant: I was going to say something along those lines but thought it just a smidge too much like good advice.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
What does "complation" mean?
Is it really for your PhD dissertation?
|
|
|
|
|
I've been playing guess the question for a while now. I think he wants an implementation of the n-Queens problem.
So far, I've got:
the complation = the compilation = code[s]
only by my code = courswork
for my doctor = to be handed into the Doctor lecturing his course = urgent.
please try to find by this method in simple code = Help
In summary:
Help,
I have coursework. Urgent Send codes plz.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Soooooo 5-ed.
//L
|
|
|
|
|
|
code sent please i give up to try
that in main topic i added code
|
|
|
|
|
You have reposted instead of adding to the original thread.
I suggest you google for the breadth-first algorithm for this problem, if that is the one you want. Then work out how to implement it in C#. This is a well known problem, there is plenty of material on the Internet.
In your first post you didn't give any code, let us know what is wrong or ask what you needed. You need to do all of this before you'll get a reasonable answer. The other thing is, people here won't do your homework / employed work for you, but it looks like you are asking for this, even if that is not what you meant.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|