0

Hi all,

The following code is generated automatically in Microsoft c++:

// InventoryAssignment(BETA).cpp : main project file.
#include "StdAfx.h"
#include "Form1.h"


using namespace InventoryAssignmentBETA;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

	// Create the main window and run it
	Application::Run(gcnew Form1());
	return 0;
}

but i faced the following errors:

Error 1 error C2143: syntax error : missing ';' before 'using'

Error 2 fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\mohamed\my documents\visual studio 2008\projects\inventoryassignment(beta)\Form1.h(5)' was matched c:\Documents and Settings\Mohamed\My Documents\Visual Studio 2008\Projects\InventoryAssignment(BETA)\InventoryAssignment(BETA).cpp 19 InventoryAssignment(BETA)

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Fouly
0

What did you change? Please don't expect us to believe that Microsoft's compiler fails to compile Microsoft's default generated code.

0

I'm astonished like you...i'll send you the code to check it

Attachments
#pragma once
#include "RandomVariableGenerator.h"


namespace InventoryAssignmentBETA {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
    private: System::Windows::Forms::ComboBox^  cmb_DemandTime;
    protected: 
    private: System::Windows::Forms::ComboBox^  cmb_DemandSize;
    private: System::Windows::Forms::ComboBox^  cmb_LagTime;
    private: System::Windows::Forms::Label^  label1;
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::Label^  label4;
    private: System::Windows::Forms::Label^  label5;
    private: System::Windows::Forms::Label^  label6;
    private: System::Windows::Forms::Label^  label7;
    private: System::Windows::Forms::TextBox^  txt_SetUpCost;
    private: System::Windows::Forms::TextBox^  txt_HoldCost;
    private: System::Windows::Forms::TextBox^  txt_PriceofItem;
    private: System::Windows::Forms::TextBox^  txt_BacklogCost;
    private: System::Windows::Forms::Label^  label8;
    private: System::Windows::Forms::Label^  label9;
    private: System::Windows::Forms::Label^  label10;
    private: System::Windows::Forms::Label^  label11;
    private: System::Windows::Forms::Label^  label12;
    private: System::Windows::Forms::Label^  label13;
    private: System::Windows::Forms::TextBox^  txt_DemandSizeB;

    private: System::Windows::Forms::TextBox^  txt_DemandSizeA;

    private: System::Windows::Forms::TextBox^  txt_DemandTimeB;

    private: System::Windows::Forms::TextBox^  txt_DemandTimeA;
    private: System::Windows::Forms::TextBox^  txt_LagTimeB;


    private: System::Windows::Forms::TextBox^  txt_LagTimeA;
    private: System::Windows::Forms::Button^  btn_StartSimulation;
    private: System::Windows::Forms::DataGridView^  dataGridView1;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column1;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column2;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column3;


	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
            this->cmb_DemandTime = (gcnew System::Windows::Forms::ComboBox());
            this->cmb_DemandSize = (gcnew System::Windows::Forms::ComboBox());
            this->cmb_LagTime = (gcnew System::Windows::Forms::ComboBox());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->label5 = (gcnew System::Windows::Forms::Label());
            this->label6 = (gcnew System::Windows::Forms::Label());
            this->label7 = (gcnew System::Windows::Forms::Label());
            this->txt_SetUpCost = (gcnew System::Windows::Forms::TextBox());
            this->txt_HoldCost = (gcnew System::Windows::Forms::TextBox());
            this->txt_PriceofItem = (gcnew System::Windows::Forms::TextBox());
            this->txt_BacklogCost = (gcnew System::Windows::Forms::TextBox());
            this->label8 = (gcnew System::Windows::Forms::Label());
            this->label9 = (gcnew System::Windows::Forms::Label());
            this->label10 = (gcnew System::Windows::Forms::Label());
            this->label11 = (gcnew System::Windows::Forms::Label());
            this->label12 = (gcnew System::Windows::Forms::Label());
            this->label13 = (gcnew System::Windows::Forms::Label());
            this->txt_DemandSizeB = (gcnew System::Windows::Forms::TextBox());
            this->txt_DemandSizeA = (gcnew System::Windows::Forms::TextBox());
            this->txt_DemandTimeB = (gcnew System::Windows::Forms::TextBox());
            this->txt_DemandTimeA = (gcnew System::Windows::Forms::TextBox());
            this->txt_LagTimeB = (gcnew System::Windows::Forms::TextBox());
            this->txt_LagTimeA = (gcnew System::Windows::Forms::TextBox());
            this->btn_StartSimulation = (gcnew System::Windows::Forms::Button());
            this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
            this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dataGridView1))->BeginInit();
            this->SuspendLayout();
            // 
            // cmb_DemandTime
            // 
            this->cmb_DemandTime->FormattingEnabled = true;
            this->cmb_DemandTime->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"Uniform", L"Exponential"});
            this->cmb_DemandTime->Location = System::Drawing::Point(116, 39);
            this->cmb_DemandTime->Name = L"cmb_DemandTime";
            this->cmb_DemandTime->Size = System::Drawing::Size(121, 21);
            this->cmb_DemandTime->TabIndex = 0;
            // 
            // cmb_DemandSize
            // 
            this->cmb_DemandSize->FormattingEnabled = true;
            this->cmb_DemandSize->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"Uniform", L"Exponential"});
            this->cmb_DemandSize->Location = System::Drawing::Point(116, 119);
            this->cmb_DemandSize->Name = L"cmb_DemandSize";
            this->cmb_DemandSize->Size = System::Drawing::Size(121, 21);
            this->cmb_DemandSize->TabIndex = 1;
            // 
            // cmb_LagTime
            // 
            this->cmb_LagTime->FormattingEnabled = true;
            this->cmb_LagTime->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"Uniform", L"Exponential"});
            this->cmb_LagTime->Location = System::Drawing::Point(116, 211);
            this->cmb_LagTime->Name = L"cmb_LagTime";
            this->cmb_LagTime->Size = System::Drawing::Size(121, 21);
            this->cmb_LagTime->TabIndex = 2;
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Location = System::Drawing::Point(24, 42);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(71, 13);
            this->label1->TabIndex = 3;
            this->label1->Text = L"Demand Time";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(24, 127);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(68, 13);
            this->label2->TabIndex = 4;
            this->label2->Text = L"Demand Size";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(24, 214);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(49, 13);
            this->label3->TabIndex = 6;
            this->label3->Text = L"Lag Time";
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Location = System::Drawing::Point(24, 358);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(68, 13);
            this->label4->TabIndex = 9;
            this->label4->Text = L"Price of Item";
            // 
            // label5
            // 
            this->label5->AutoSize = true;
            this->label5->Location = System::Drawing::Point(277, 289);
            this->label5->Name = L"label5";
            this->label5->Size = System::Drawing::Size(53, 13);
            this->label5->TabIndex = 8;
            this->label5->Text = L"Hold Cost";
            // 
            // label6
            // 
            this->label6->AutoSize = true;
            this->label6->Location = System::Drawing::Point(24, 289);
            this->label6->Name = L"label6";
            this->label6->Size = System::Drawing::Size(61, 13);
            this->label6->TabIndex = 7;
            this->label6->Text = L"SetUp Cost";
            // 
            // label7
            // 
            this->label7->AutoSize = true;
            this->label7->Location = System::Drawing::Point(277, 358);
            this->label7->Name = L"label7";
            this->label7->Size = System::Drawing::Size(68, 13);
            this->label7->TabIndex = 10;
            this->label7->Text = L"Backlog Cost";
            // 
            // txt_SetUpCost
            // 
            this->txt_SetUpCost->Location = System::Drawing::Point(137, 289);
            this->txt_SetUpCost->Name = L"txt_S
// InventoryAssignment(BETA).cpp : main project file.
#include "StdAfx.h"
#include "Form1.h"


using namespace InventoryAssignmentBETA;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

	// Create the main window and run it
	Application::Run(gcnew Form1());
	return 0;
}
#include "StdAfx.h"
#include "RandomVariableGenerator.h"
#include "math.h"

RandomVariableGenerator::RandomVariableGenerator(void)
{
}
double RandomVariableGenerator::GetRandomNumber(void)
{
    // Zi = (AZi-1 + C)(mod m)
    // Zi = (5Zi-1 + 3)(mod 16)
    return RandomVariableGenerator::Znode =  fmod((5.0*RandomVariableGenerator::Znode + 3),16);
    //return RandomVariableGenerator::Znode/16;
}
double RandomVariableGenerator::GetExponential(double beta)
{
    return (-beta)*log(GetRandomNumber());
}
double RandomVariableGenerator::GetUnifrom(double a, double b)
{
    return (a + GetRandomNumber()*(b-a));
}
double RandomVariableGenerator::GetValue()
{
    if(DistributionType == (int)(RandomVariableGenerator::Distribution::uniform))
    {
        return GetUnifrom(a,b);
    }
    else
    {
        return GetExponential(beta);
    }
}
#pragma once

ref class RandomVariableGenerator
{
public:
    RandomVariableGenerator(void);
    static double Znode = 7.0;

    static double a,b,beta;

    static double GetValue();

    static int DistributionType;

    enum class Distribution
    {
        uniform = 0,
        exponential = 1
    };


   

private:
    // The deliver Lag in uniform: L = a + U(b-a)
    
    
    // Zi in LCG
    static double GetRandomNumber();
    static double GetExponential(double beta);
    static double GetUnifrom(double a, double b);
    
    

    

};
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.