|
Hi,
Im looking for the source code of the Eliza (The a.i program written by Joseph Weizenbaum) program, written in c++. Would be great if someone would reply with the source code......... Thanks a Bunch
Kiddo
|
|
|
|
|
Sorry, but have you ever heard of Google? BASIC Source
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi all
I've been teaching C++ for about 10 years (unmanaged using Borland Compilers), and for the first time this year I am teaching managed C++ using MS Visual Studio .NET. The first part of the course concentrates on procedural programming in a console environment, and one of the topics is writing / reading to text files (which is OK), and printing data to a printer (local LPT1 printer). In unmanaged code, I would write is as follows :
#include
void main(void)
{
char data[80];
ifstream infile;
ofstream printer;
infile.open("TEST.TXT", ios::in);
printer.open("PRN");
while (infile)
{
infile.getline(data,80);
if (infile)
{
printer << data << "\n";
}
}
};
However, I cant find a simple way to set up a stream to the local printer in a console based environment using managed code. The file handling part is fine, and would look as follows :
// Filein1.cpp
#include "stdafx.h"
#using
using namespace System;
using namespace System::IO;
int _tmain()
{
String *record;
StreamReader * fileIn = File::OpenText(S"Test.txt");
// Need to set up stream to printer here
while ((record = fileIn->ReadLine()) != 0)
{
Console::WriteLine(S"{0}",record); // need to replace with output to printer stream
}
Console::ReadLine();
fileIn->Close();
return 0;
}
Can anyone help me fill in the gaps ?
Many thanks
Simon Cornish
Simon Cornish
|
|
|
|
|
HELLLLOOOOOOOOOOOOOOOOOOOOOO!!!!! PLEASE........!!!!!!!
|
|
|
|
|
1. don't hurry the guys that can help you, otherwise you'll have to find your answer by yourself.
2. ask the wrong forum
3. DON'T SHOUT !!!
4. be discret when it is your first posts here.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
is there anybody that know how to connect, when i enter matrik no at client side then at the admin side the statistic graph will increase everytime i enter the number. only admin can see this statistic.. please anybody know?
|
|
|
|
|
you are on a Managed C++ forum... ask your question on the right forum, respecting the rules Chris maunder exposes on his posts at the beginning of each forum (you should have a look !!!).
ask this here[^] and please redt this[^] before going further)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 3:58 Thursday 24th November, 2005
|
|
|
|
|
I have an application in which i am trying to call some dll imported function that are exported using c++ calling convention. There are couple of function exported using c calling convention. When i import all those function in my application i am able to call functions that are exported using c calling convention but not able to call functions that are exported using c++ calling convention.
any help is greatly appreciated..
thanks, Ramendra
Ramendra K
|
|
|
|
|
Hi All,
I have an issue storing derived class objects and calling their overloaded member functions. To illistrate the problem, picture this:
<br />
class Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << i << endl; }<br />
};<br />
<br />
class A : public Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << "i - " << i << endl; }<br />
};<br />
<br />
class B : public Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << "i : " << i << endl; }<br />
};<br />
<br />
void global_func (Base& B) { B.func1 (1); }<br />
In this e.g. you can send A , B or Base into global_func. Now we want to link A and B together so we create a seq class and overload the operator >>:
<br />
class seq : public Base<br />
{<br />
public:<br />
seq (A _a, B _b) : m_a (_a), m_b (_b) { }<br />
A& m_a;<br />
B& m_b;<br />
void func1 (int i) { m_a.func1 (i); m_b.func1 (i); }<br />
};<br />
<br />
seq operator>> (A& _a, B& _b) { return seq (_a, _b); }<br />
Now we can write objA >> ObjB , to do both func1 in A and B at the same time. We inherit from base, because then we can pass seq in global_func . However linking a whole string together become quite irritating esp. when you use ObjA >> ObjB often.
So this is the problem, how do you store the seq generically (i.e. if there is a sequence that does B before A, but would like to it in the same object).
I thought about using a collect class:
<br />
class collect<br />
{<br />
public:<br />
collect (Base& B) : m_base (b) { }<br />
Base m_base;<br />
void func1 (int i) { m_base.func1 (i); }<br />
};<br />
But when I create the collect and global_func calls func1 , it calls it in Base not seq
Idea's, or have I just missed the plot?
thanks,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Could any one please let me know what is the use of virtual destructors?
At what point of time we use these virtual destructors?
Nice talking to you.
|
|
|
|
|
Hi,
G Haranadh wrote: Could any one please let me know what is the use of virtual destructors?
Virtual helps with derived classes. If you child class allocs memory and deallocs it in the destructor, then you will always want the child class' destructor to run. If the base class' destructor is not virtual then if the base class detructs it will not call the child class and memory will leak. When it is virtual it will call the child class before the base class.
G Haranadh wrote: At what point of time we use these virtual destructors?
When Objects destruct
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
I have a C++ app that includes a 3rd party library that has a type called
'System'. This class exists in a namespace, let's call it XYZ::System.
Then I am compiling my C++ app with /clr and somehow when VC8 includes
xlocale (which in turn uses a macro defined in yvals.h) that calls a method in .NET (System.bla.bla) there is an ambiguity.
How can I resolve this easily?
|
|
|
|
|
use ::System and XYZ::System instead of just use System
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
Well that might work for my own source code but VC8 includes VC headers that call managed code and make calls to System:: namespace classes. This means I would have to modify all of these Microsoft headers by hand for this to work, which would be impossible to do without causing all sorts of other headaches.
Is there not some way to rename a known .NET namespace to another name? Like rename ::System to ::DotNetSystem ?
|
|
|
|
|
try surrounding your include line with #define and #undef to avoid name collision..
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
If I do something like the following:
#define<br />
#include "XYZ.h"<br />
using namespace XYZ;<br />
#undef
I get the following error:
error C2007: #define syntax
I get that error withour without the using namespace statement as well.
Is that what you meant or was it something else?
|
|
|
|
|
Hi All,
I am new in c++, I want to draw a simple graph between two values using c++, Can anyone help me. ?
Mareo
|
|
|
|
|
|
Guys I also have the algorithm see if this helps! THanx alot!
Input & Output~~~
The user will enter
1 for a triangle
2 for a rectangle
or 0 to quit
Any other number is unacceptable.
Use a loop to force the user to enter a valid value
Use a menu format for a prompt
If the user enters 1 or 2, she should be prompted to read a single character that will be used to create the figure.
any keyboard character may be specified
For a triangle, the user will enter the height of the triangle.
The output is a triangle created with height representing the number of lines on the screen. For example, a height of three would look like:
*
**
***
For rectangles, the user will enter the height and width of the rectangle.
The output is a rectangle created with height representing the number of lines on the screen and the width is the number of characters on each line. For example, a height of three and a width of four would look like:
****
****
****
Main should print the total number of characters used or an error message.
Algorithm~~~~
Create a main program loop controlled by the users response in the next step
Use a menu to ask the user to select 0, 1 or 2 (quit, triangle, rectangle)
Use a call-by-reference utility function to force the user to enter a number between 0 and 2.
If the user said to quit, leave the main loop.
Otherwise
use a call-by-reference function to ask the user to enter a character to be used when displaying the figure.
Use a call-by-reference function to ask the user to enter a height and (for rectangles only) a width.
Call a function that creates the image and returns
the number of characters used to create the image
or, 0 if the image was not created
An error has occured (return 0) if
the height is less than 1 or larger than 20
the width is less than 1 or larger than 40
This function must call another function to create one line of the image
main should check the value returned
Print the number of characters used
say something if an error occurred (zero return value)
|
|
|
|
|
|
Every Body can do that, but they have their ovn application to make. This is soooooo Simple even you can do it. Have you readed any tutorial or any Book on c++. They give you some basic enogh to make that simple app. If you need a tutorial on managed c++ you can finde it
here:
http://www.functionx.com/managedcpp/index.htm[^]
Don't you even know how to start? If you do, then just start and try to program with some brain.
|
|
|
|
|
Guys Iam an amatuer in C++ language. I need help with this program. Please if anybody can help me with it. Please write a code for me. Its a simple program but I dont know how to do it. Please its really important for me to do this stuff! THanks alot!
I have the output to how this program looks and Iam supposed to write a code for this. Please help me out buddies!
Here is the link to this Program output please download it and change the extension to .EXE . THankx alot guys! Waiting for early reply!
LINK~~~~http://www.megaupload.com/?d=6QQALGT9
|
|
|
|
|
Hi, I have a problem validating with a XmlValidatingReader and a .xsd file
the validation breaks when the importDate attribute is parsed
< Info importDate = "1967-08-13" />
in the .xsd is defined as
< xs:attribute name="importDate" type="xs:date" use="required" />
and the error message is
"The 'importDate' attribute has an invalid value accordint to its data type. An error occurred at, (12, 44)"
Anyone has an idea why this happens, when I validate the same XML file in the XMLSpy it works fine, then i run my program and it breaks in that line, if I remove the line then everything works
Thanks in Advance
Isaac B
|
|
|
|
|
hello,
I inherited C/C++ source code with a lot of precompiled defines depending on the product to compile for. A lot of these defines are also nested. So changing the software for one product is difficult as the code is not really readable. Placing the new code between the wrong defines implies wrong functioning of other products afterwards.
Does anyone knows an editor in which I can define which defines are used so that I only see the code that is used ?
stoffel
|
|
|
|
|
How to change CEdit's background color and text color? thanks.
|
|
|
|