|
i am very sorry.
there is no error on the program at the moment but what it supposed to do is take input from users enter dates for example if you run it, the output is
12/12/2003 but i want it to accept more than one date for example
12/01/2003
13/12/2003
14/03/2003 and so on.
This is the actual code
<br />
#include "stdafx.h"<br />
<br />
#using <mscorlib.dll><br />
using namespace std;<br />
<br />
class Day{<br />
private:<br />
int day,month,year;
<br />
public:<br />
Day(int,int,int);
~Day();
<br />
void display();<br />
};<br />
<br />
Day::Day(int d,int m,int y){
day=d;month=m;year=y;
<br />
}<br />
<br />
Day::~Day(){}<br />
<br />
<br />
void Day::display(){<br />
std::cout<<day<<'/'<<month<<'/'<<year<<std::endl;
<br />
}<br />
<br />
int main(){<br />
int d,m,y;<br />
std::cout<<"Please Input the date :\n";<br />
std::cin>>d>>m>>y;<br />
Day MyDay(d,m,y);
<br />
MyDay.display();<br />
<br />
}
|
|
|
|
|
Just put a loop in yout main:
int main(){
int d,m,y;
for (int i=0;i<10;i++)
{
std::cout<<"Please Input the date :\n";
std::cin>>d>>m>>y;
Day MyDay(d,m,y);
MyDay.display();
}
}
This will allow you to enter 10 times the date.
|
|
|
|
|
this is what i made up now but it is not working
while(MyDay!=0)<br />
{<br />
cout << Day<br />
}
|
|
|
|
|
the date should be printed say 30 if it is jan,feb,march,may,july, august , oct ,dec then 31 for sept ,april ,june and nov and 28 for feb.
|
|
|
|
|
Pete,
if you really expect people to help you, then you should start expressing yourself a little more precise. I don't blame you for your lack of programming skills or understanding of the language because we have all been rookies, but with short phrases like this:
"he date should be printed say 30 if it is jan,feb,march,may,july, august , oct ,dec then 31 for sept ,april ,june and nov and 28 for feb"
you'll probably get no further assistance here. However in additon i would recommend you to read some tutorials about c++ or programming in general.
I hope this was not too harsh...
cheers Tobias
|
|
|
|
|
Run in degug mode, then you will see an exact error message, or at least run every line, then you will find what is the problem.
|
|
|
|
|
Hello there,
I'm trying to build a couple of projects automatically using a build script. In these projects there are a couple of VS.Net 2005 C++ projects with different project directory (include/library) settings. The reason why I can't just place all these directory settings together is because some libraries conflict with each other.
I'm trying to build these projects in the build script using the "devenv.exe /build ..." command. How can I change the directory settings using the "devenv.exe" command, or is there another way?
Thanks!
~Rafferty
|
|
|
|
|
hm.. no one's replying. Does this mean this is not possible?
|
|
|
|
|
Rafferty Uy wrote: hm.. no one's replying. Does this mean this is not possible?
No. It menas, nobody read it that would know the answer, or are too lazy to write it down.
ps: I don't know the answer
|
|
|
|
|
I realize that error descriptions have gotten better, but they still need to come a long way. I will post both my error message and code in hopes that someone can help me out with this, because I am lost.
error:
error C3767: 'JensonDispatch::DataOperations::DataOperations': candidate function(s) not accessible c:\documents and settings\kathy\my documents\visual studio 2005\projects\jenson dispatch\jenson dispatch\MainForm.h 24
DataOperations.cpp
<br />
#include "StdAfx.h"<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch<br />
{<br />
DataOperations::DataOperations(void)
{<br />
}<br />
<br />
DataOperations::~DataOperations(void)
{<br />
}<br />
<br />
int DataOperations::ConnectToDataStore(SqlConnection^ conn, String ^query)<br />
{<br />
try {<br />
SqlCommand^ sqlComm = gcnew SqlCommand(query, conn);<br />
sqlComm->ExecuteNonQuery();<br />
MessageBox::Show("Connected!");<br />
}<br />
catch (Exception^ e) {<br />
MessageBox::Show("Error!", e->ToString());<br />
}<br />
return 0;<br />
}<br />
<br />
int DataOperations::DisconnectFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
} <br />
<br />
int DataOperations::AddCallToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCallFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::AddCustomerToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCustomerFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
}<br />
DataOperations.h
<br />
#pragma once<br />
<br />
namespace JensonDispatch<br />
{<br />
using namespace System;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::IO;<br />
using namespace System::Windows::Forms;<br />
<br />
public ref class DataOperations<br />
{<br />
DataOperations(void);<br />
~DataOperations(void);<br />
public: <br />
int ConnectToDataStore(SqlConnection^, String^);<br />
int DisconnectFromDataStore(SqlConnection^, String^);<br />
int AddCallToDataStore(SqlConnection^ , String^);<br />
int RemoveCallFromDataStore(SqlConnection^, String^);<br />
int AddCustomerToDataStore(SqlConnection^, String^);<br />
int RemoveCustomerFromDataStore(SqlConnection^, String^);<br />
};<br />
}<br />
MainForm.h:
<br />
#pragma once<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch <br />
{ <br />
using namespace System;<br />
using namespace System::ComponentModel;<br />
using namespace System::Collections;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::Drawing;<br />
<br />
public ref class MainForm : public System::Windows::Forms::Form<br />
{<br />
public:<br />
MainForm(void)<br />
{<br />
InitializeComponent(); <br />
MainForm::AddCallRadioButton->Checked = true;<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
String^ ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=""C:\\ProgramFiles\\Microsoft SQL Server\\MSSQL.\\MSSQL\\Data\\ServiceCalls.mdf"";<br />
Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
SqlConnection^ SqlConn = gcnew SqlConnection(ConnectionString);<br />
String^ QueryString = "";<br />
DataOperations^ dOps = gcnew DataOperations();
<br />
dOps->ConnectToDataStore(SqlConn, QueryString);<br />
}<br />
<br />
protected:<br />
~MainForm()<br />
{<br />
if (components) {<br />
delete components;<br />
}<br />
}<br />
#pragma region MainForm Components<br />
#pragma endregion<br />
#pragma region Windows Form Designer generated code<br />
#pragma endregion<br />
<br />
private: System::Void AddCallRadioButton_CheckedChanged(System::Object^ sender, <br />
System::EventArgs^ e) {<br />
if (MainForm::AddCallRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
if (MainForm::LookupRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Search";<br />
}<br />
};<br />
}<br />
Also, if anyone sees that I'm doing something blatently wrong or has contructive criticism, please by all means let me have it
Thanks,
John
|
|
|
|
|
Your class, DataOperations, has a private constructor (ctor), DataOperations(), and a private destructor, dtor, ~DataOperations(). I believe your program requires your ctor and dtor to be public.
|
|
|
|
|
ah ha! working now. thanks a lot. I thought default constructors were public by default.
thanks again!
Thanks,
John
|
|
|
|
|
i need to supply the name of the XML document when i run the program,,is it right what i did?
it didn't work? how can i make it plz?
#using<<mscorlib.dll>>
using namespace System;
#using <<system.xml.dll>>
using namespace System::Xml;
int main(int argc, char* argv[])
{
//check for required arguments
if (argc <2)
{
Console::WriteLine("Usage :CppXmlTextReader path");
return -1;
}
String^ path = gcnew String(argv[1]);
try
{
//create the reader...
XmlTextReader^ rdr = gcnew XmlTextReader(path);
//Read nodes
while (rdr->Read())
{
//do something with the data
}
//read nodes
while (rdr->Read())
{
switch (rdr->NodeType)
{
case XmlNodeType::XmlDeclaration:
Console::WriteLine("->XML declaration");
break;
case XmlNodeType:ocument:
Console::WriteLine("->Document node");
break;
case XmlNodeType::Element:
Console::WriteLine("->Element node, name{0}",rdr->Name);
break;
case XmlNodeType::EndElement:
Console::WriteLine("->End element node,name={0}",rdr->Name);
break;
case XmlNodeType::Text:
Console::WriteLine("->Text node,value={0}",rdr->Value);
break;
case XmlNodeType::Comment:
Console::WriteLine("->Comment node, name={0},value={1}",rdr->Name,rdr->Value);
break;
case XmlNodeType::Whitespace:
break;
default:
Console::WriteLine("**UnKnown node type");
break;
}
}
}
catch (Exception^ pe)
{
Console::WriteLine(pe->ToString());
}
return 0;
}
-- modified at 15:54 Monday 13th March, 2006
|
|
|
|
|
Try using "int main(array<System::String ^> ^args)" instead of "int main(int argc, char* argv[])"!
|
|
|
|
|
i got the following error:
error c2693: '<':illegal comparison for references to a managed array when i check on arguments,,how can i solve it? how about the constructor?
|
|
|
|
|
// In C++/CLI the "exe" name is not included in the argument array.
// If your path has has spaces, be sure to surround it with quotes.
// Example CppXmlTextReadr "c:\program files\file.xml"
int main(array<System::String ^> ^args)
{
if (args->Length < 1)
{
Console::WriteLine("Usage :CppXmlTextReader path");
return -1;
}
String^ path = args[0];
Console::WriteLine(path);
return 0;
}
|
|
|
|
|
Excuse me, Sorry,,but i don't know where to place the path of the XML file,,
when i run my program in the command line i write it? or how?
|
|
|
|
|
If you are talking about running your program from Visual Studio, here is what you do:
1. Right-click on your project.
2. Click on "properties"
3. Under "Configuration Properties", click on "Debugging".
4. On the right of the window, you will find "Command Arguments". Place your arguments there.
Peace
|
|
|
|
|
Hello all people,
I need make a application that update the BIOS information:
Vendor name, BIOS Version, BIOS build date and more.
I used to know that I have to use the 52h function. I don´t know how complex is this task.
That app must run on DOS.
I really need that. Can be Basic, QBasic, Fortran, Cobol, Assembler, C/C++. Any DOS suported language!!
thanks all!
|
|
|
|
|
C++/CLI does not run in DOS. You may not get your answer here!
|
|
|
|
|
|
Hello all people,
I need make a application that update the BIOS information:
Vendor name, BIOS Version, BIOS build date and more.
I used to know that I have to use the 52h function. I don´t know how complex is this task.
somebody have a code to make this. may be in any language ( mainly in C/C++).
thanks all!
|
|
|
|
|
C++/CLI does not run in DOS. You may not get your answer here!
|
|
|
|
|
a dll not had source, how know it parameter's number and is WINAPI or CDECL?
|
|
|
|
|
Since you posted in the C++/CLI forum, you implicitly admit your DLL was written in .NET. If you were lying and this DLL was not written in .NET then you have just posted in the wrong message board. Repost this question in the message board.
Note that in .NET, CLR functions only have one calling convention, and that is __clrcall. The WINAPI or CDECL stuff only applies to native DLLs. If your function has uses WINAPI/CDECL, then your function is not written in .NET (see above).
Also note that .NET DLLs do not export their CLR functions as dllexports. Instead, the functions are stored as Metadata, and are discovered using Reflection.
The quick way to check the function signature is to add the DLL as a project reference (Project -> References -> Add New Reference -> Browse -> select your DLL -> OK OK). If this doesn't work, then your DLL is not a .NET DLL (see above).
Now click on view Object Browser, and go down to the namespace of the DLL. This will show you all the function signatures in that DLL.
How do you do this programmatically?
The functions to use are given in System::Reflection. Once you have the System::Assembly of the DLL, call the Assembly::GetTypes method to get all the types of the assembly. Then you can call the GetMethods to get the methods in that Type (including private ones).
To get the number and type of parameters, check out MethodInfo::GetParameters. That should allow you to discover the signature of the method.
|
|
|
|
|