|
From: Noorez K. <coo...@ho...> - 2004-05-29 07:10:54
|
This program needs args passed to it with the cmd prompt. If it doesn't find
any then it should display a message saying that you need the args but all I
get is an error message upon opening the program.
#include <iostream>
#include <cstdlib>
#include <string>
#include <conio.h>
using namespace std;
int main(int args, char* pszArgs[])//there needs to be args for this to work
{
if(strcmp(pszArgs[1],"-nt")== 0)
{
system("cls");//start with a clear screen
//explain what the heck all this does
cout << "Welcome to the easy program opener!\n";
cout << "Hear is a list of programs that can be easy opened\n\n";
cout << "To quit enter 0 or nothing for a program choice\n";
cout << "1. Microsoft Office\n";
cout << "2. Microsoft Paint\n";
cout << "3. Calculator\n";
cout << "4. Internet Explorer\n";
int choice;
while(1)
{//while
choice = 0;
cout << "\nEnter the number of your choice: ";
cin >> choice;
cin.sync();
switch(choice)
{//switch
case 0:
cout << "Exiting easy opener...\n";
//Sleep(1000);
return 0;
break;
case 1:
system("start winword");
break;
case 2:
system("mspaint");
break;
case 3:
system("calc");
break;
case 4:
{
char site[123];
char intern[] ="start iexplore ";
cout << "Enter site: ";
cin.getline(site,123);
strcat(intern,site);
system(intern);
break;
}
default://the choice wasn't a valid one if we are at default
cout << "Not a valid choice\n";
}//switch
}//end while
}//done defining nt operating system
else if(strcmp(pszArgs[1],"-me")==0)
{
system("cls");
cout << "Welcome to the easy program opener!\n";
cout << "Hear is a list of programs that can be easy opened\n\n";
cout << "To quit enter 0 or nothing for a program choice\n";
cout << "1. Microsoft Office\n";
cout << "2. Microsoft Paint\n";
cout << "3. Calculator\n";
cout << "4. Internet Explorer\n";
int choice;
while(1)
{
cout << endl << "Enter choice: ";
cin >> choice;
cin.sync();
switch(choice)
{
case 0:
cout << "Exiting easy opener...\n";
//Sleep(1000);
return 0;
break;
case 1:
system("start winword");
break;
case 2:
system("pbrush");
break;
case 3:
system("calc");
break;
case 4:
{
char site[123];
char intern[] ="start iexplore ";
cout << "Enter site: ";
cin.getline(site,123);
strcat(intern,site);
system(intern);
break;
}
default:
cout << "Not a valid choice\n";
}//end switch
}//end while
}//end defining me operating system
else
{
cout << "Args needed\n";
system("pause");
return 0;
}
return 0;//exit program
}
_________________________________________________________________
Add photos to your e-mail with MSN Premium. Get 2 months FREE*
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
|