hello, i am debugging my code, im getting the error: expected constructor, destructor, or type conversion before '<<' token, on line 16
any help would be appreciated, thankyou!
// DTLoader copyright 2013 Declan Thomas
#include <cstdio>
#include <cstdlib>
#include <iostream>
usingnamespace std;
int question;
int install;
int run;
int cmd;
int nsupport;
int example;
int answer;
int answer2;
int notepadplusplus;
int main(int nNumberofArgs, char* pszargs[]);
cout << "Hello, Would you like to install or run a program?\n"
cin >> answer
{
if (answer==install)
system("cd \bat")
system("install.bat")
if (answer==run)
cout << "What is the name of the application you would like to run?\n"
cin >> answer2
if (answer2==cmd)
system("cd \bat")
system("cmd.bat")
if (answer2==notepadplusplus)
system("cd \bat")
system("notepadplusplus.bat");
system ("PAUSE")
Return 0;
}
There are bunch of errors in the code, first of all most of your statements are not terminated. Secondly, you're writing the control statements like you're writing comprehension in English.e.g.
1 2 3 4 5
if (answer==install)
//whats the value of install?
//right, install was declared as an integer, № value was assigned
//if install were a char, so that if answer='i' or string so that answer="install"
//then fine
Your have two statements before main's {, And you are missing a bunch of ;
That fixed my problem main problem, thank you!
ive edited my code to make it compile-able, but it still dosn't work
when adding quote marks (eg answer="cmd") i get the error "error c++ forbids comparison between interger and pointer.",
sorry ive only been learning 1 week. any help?
thanks
here is the edited code:
// DTLoader copyright 2013 Declan Thomas
// this program (at current state) exacutes bat files which copys zips to a directory and unzips them, then gives the option to exacute exe files inside
// this is in alpha state, not representative of the final product
#include <cstdio>
#include <cstdlib>
#include <iostream>
usingnamespace std;
int answer;
int answer2;
int install;
int run;
int cmd;
int notepadplusplus;
int main(int nNumberofArgs, char* pszargs[])
{
system("title DTLoader Alpha 0.1");
cout << "DTLoader (C) Declan Thomas 2013\n";
cout << "To learn how to use DTLoader, read the included READ-ME-1ST File.\n";
cout << "Enter a exacuteable command, or type cmd to open the command.com enviroment,";
cout << "or cmda to open the CMD enviroment (only works if security is crap)\n";
cin >> answer;
if (answer == install); // im wanting it so when user types install, the following exacutes
{
system("CD C:\\Users\\Admin\\Desktop\\DTLoader\\bat");
system("CALL install");
system("PAUSE");
return 0;
}
if (answer == cmd)
{
system ("echo off\n command \n command.com \n pause"); // This is an experement.
}
if (answer == run);
{
cout << "What is the name of the application you would like to run?\n"; //The run command will allow the runing of programs
cin >> answer2;
if (answer2 == cmd);
{
system("CD C:\\Users\\Admin\\Desktop\\DTLoader\\bat"); // Command.com launcher
system("CALL cmd.bat");
return 0;
}
if (answer2 == notepadplusplus);
{
system("CD C:\\Users\\Admin\\Desktop\\DTLoader\\bat"); // notepadpp launcher
system("CALL notepadplusplus.bat");
system("PAUSE");
return 0;
}
}
system ("PAUSE"); // end
return 0;
}