Click here to Skip to main content
15,905,607 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralImporting DLL of C# application Pin
student666927-Apr-04 14:45
student666927-Apr-04 14:45 
GeneralRe: Importing DLL of C# application Pin
RNEELY28-Apr-04 9:41
RNEELY28-Apr-04 9:41 
GeneralRe: Importing DLL of C# application Pin
student666929-Apr-04 10:50
student666929-Apr-04 10:50 
GeneralRe: Importing DLL of C# application Pin
RNEELY30-Apr-04 3:17
RNEELY30-Apr-04 3:17 
GeneralRe: Importing DLL of C# application Pin
student66692-May-04 18:12
student66692-May-04 18:12 
Generalcalling function in mixed mode assembly from unmanaged app Pin
godzooky27-Apr-04 6:22
godzooky27-Apr-04 6:22 
GeneralProblem with HDCs Pin
Serge Lobko-Lobanovsky27-Apr-04 2:37
Serge Lobko-Lobanovsky27-Apr-04 2:37 
GeneralLinear Search Pin
buttons25-Apr-04 10:02
buttons25-Apr-04 10:02 
Confused | :confused: The search function I have isn't working, possibly because of the scope of the while & if functions or that I am using the wrong functions.
Please see if a different [U]search [/U] or maybe if the [U]code[/U] needs changing, Thank you button.

[code]
#include <iostream.h> //Pre Processor Directives
#include <fstream.h> //Libary for Input funcitons
#include <iomanip.h> //Input/Output manipulation libary
#include <string.h>

void main()
{
ofstream file("Database"); //Create a new file
file.open("Database");

char* name[9];
name[0] = NULL;
name[1]="HP4p";
name[2]="HP5L";
name[3]="HP6p";
name[4]="Cannon2A";
name[5]="Cannon3B";
name[6]="Epson2";
name[7]="Epson3";
name[8]="Epson4A";

float cost[9];
cost[1]=32.99;
cost[2]=24.99;
cost[3]=30.00;
cost[4]=23.45;
cost[5]=31.99;
cost[6]=25.00;
cost[7]=30.00;
cost[8]=27.99;

int quantity[9];
quantity[1]=100;
quantity[2]=50;
quantity[3]=75;
quantity[4]=30;
quantity[5]=80;
quantity[6]=10;
quantity[7]=25;
quantity[8]=30;

char name8[13]="Cartridge";
char cost8[11]="£00.00p";
char quantity8[12]="Quantity";
{
for (int x = 1; x < 8; x++)
file<<name[x]<<' '<<cost[x]<<' '<<quantity[x];
}
file.close(); //close the file

int num=0,x;
char sought[15]; //Declare Variables

cout<<"Display all records press '1' "<<"Do a Search press '2' "<<" '0' to Quit "<<endl;
cin>>num;

if (!num==0)
{
if (num==1)
{
cout<<"Total Items in stock \n"<<endl<<endl;

ifstream file("Database",ios::in); //ios::in for input from the file

cout<<setw(20)<<setfill(' ')<<setiosflags(ios::left)<<name8;
cout<<setw(10)<<setfill(' ')<<setiosflags(ios::right)<<cost8;
cout<<setw(12)<<setfill(' ')<<setiosflags(ios::right)<<quantity8<<endl;

for (int x = 1; x < 8; x++)
{
cout<<endl<<setw(20)<<setfill(' ')<<setiosflags(ios::left)<<name[x];
cout<<setw(8)<<setfill(' ')<<setiosflags(ios::right)<<cost[x];
cout<<setw(8)<<setfill(' ')<<setiosflags(ios::right)<<quantity[x];
}
}

cout<<endl<<endl<<"Display all records press '1' ";
cout<<"Do a Search press '2' "<<" '0' to Quit "<<endl;
cin>>num;

if (num==2)
{
cout<<endl<<"To search by the printers make type in the name e.g HP4p: Type 'N' for no more"<<endl;
cin>>sought;

ifstream file("Database"); //open file for input FROM file
//while(!file.eof())
//{ //file.seekg(0); //set file pointer to first character

if (strcmp(sought,"N")!=0)
{
delete [] name[0]; //it is safe to call delete [] on NULL pointer.
name[0] = new char[strlen(sought)];

strcpy(name[0],sought);

x=8;

while (strcmp(name[x],sought)!=0)
x--;

if (strcmp(name[x],sought)==0)
{
cout<<endl<<setw(20)<<setfill(' ')<<setiosflags(ios::left)<<name[x];
cout<<setw(8)<<setfill(' ')<<setiosflags(ios::right)<<cost[x];
cout<<setw(8)<<setfill(' ')<<setiosflags(ios::right)<<quantity[x]<<endl;
}
else
{
cout<<"No such item in stock"<<endl<<endl;
}

file.close();

cout<<"Display all records press '1' ";
cout<<"Do a Search press '2' "<<" '0' to Quit"<<endl;
cin>>num;
}
}

}
}[/code]
GeneralBuilding Managed C++ Web Services Pin
Antti Keskinen22-Apr-04 8:59
Antti Keskinen22-Apr-04 8:59 
GeneralRe: Building Managed C++ Web Services Pin
ian mariano25-Apr-04 14:11
ian mariano25-Apr-04 14:11 
GeneralC++ Files Pin
buttons22-Apr-04 3:44
buttons22-Apr-04 3:44 
GeneralRe: C++ Files Pin
mccoyn22-Apr-04 5:41
mccoyn22-Apr-04 5:41 
GeneralRe: C++ Files Pin
Phil Boyd22-Apr-04 6:25
Phil Boyd22-Apr-04 6:25 
GeneralRe: C++ Files Pin
Navin23-Apr-04 9:42
Navin23-Apr-04 9:42 
GeneralInheritance of String class Pin
ra_sasi21-Apr-04 10:45
ra_sasi21-Apr-04 10:45 
GeneralRe: Inheritance of String class Pin
Phil Boyd22-Apr-04 6:26
Phil Boyd22-Apr-04 6:26 
GeneralRe: Inheritance of String class Pin
ra_sasi23-Apr-04 6:58
ra_sasi23-Apr-04 6:58 
GeneralEmbed C# controls in MFC dialogs/views Pin
rkvs20-Apr-04 7:49
rkvs20-Apr-04 7:49 
GeneralFailed in calling Manged Method from Unmanged code Pin
sanjay.attri20-Apr-04 1:33
sanjay.attri20-Apr-04 1:33 
GeneralTry to make a Manged project in C++ 2003 Pin
Harry200419-Apr-04 16:06
Harry200419-Apr-04 16:06 
GeneralLNK2022 metadata inconsistent Pin
mattknowles719-Apr-04 13:15
mattknowles719-Apr-04 13:15 
GeneralSystem.MemoryException Pin
BlackDice19-Apr-04 4:44
BlackDice19-Apr-04 4:44 
GeneralScaling drawings Pin
AnsGe19-Apr-04 3:08
AnsGe19-Apr-04 3:08 
Generaltimer in C++ Pin
Karthik Ram16-Apr-04 21:27
Karthik Ram16-Apr-04 21:27 
GeneralRe: timer in C++ Pin
Michael Mac17-Apr-04 4:02
Michael Mac17-Apr-04 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.