Would this C++ program work?


//my first attempted program in C++, just a GUI for my computers driver disk.

#include <iostream>
#include <string>

using namespace std;

int main ()

string printinfo = "Driver CD 0.1'\n'Created by Travis Paul Hesketh for Cyberpower Gamer Infinity custom. Press Quit to exit at any time.";
cout << printinfo;
/*printing the standard info (e.g Version and programmer, now onto serious stuff :)*/

/*Asking name and driver*/
int main ()
{
char question[] = "Please, enter your first name: ";
char greeting[] = "Welcome, ";
char yourname [15];
cout << question;
cin >> yourname;
cout << greeting << yourname << "! Please select a driver to install and press the Return key.";
}

/*Finished asking name, now to show the input to select driver*/

{
int i;
cout << "Please enter a driver number: '\n' Press the 1 button to start installation of nVidia GeForce 9800GT 512MB Driver '\n' or '\n' Press the 2 button to start installation of RealTek HD Audio 7.1 Card Driver";
cin >> i;
cout << "The value you entered is " << i;
cout << ". Opening installer file."
}

{
if 1 then
int result;
result = system (D:\Drivers\nvidia.exe);
}

{
if 2 then
int result;
result = system (D:\Drivers\sound.exe);
return 0;
}


Would that work and how would I compile it using Visual C++ 2008?? I'm new to C++ and want to make a small driver disk for my computer. This being the only .cpp file.
No...you have A LOT of errors...start here:

http://www.cplusplus.com/doc/tutorial/program_structure.html
I just noticed those. I've worked out on Visual C++ it puts a long green line down everything that's right :)

There's the current code. I'm getting a "syntax error : missing ';' before '<<'", where does that go? That's the only error.

//my first attempted program in C++, just a GUI for my computers driver disk.
#include <iostream>
#include <string>
using namespace std;


int main ()

{
cout << "Driver CD 0.1'\n'Created by Travis Paul Hesketh for Cyberpower Gamer Infinity custom. ";
/*printing the standard info (e.g Version and programmer, now onto serious stuff :)*/
/*Asking name and driver*/
cout << "Welcome, Travis";
cout << "Please select a driver to install and press the Return key.";
/*Finished welcome, now to show the input to select driver*/
int i;
cout << "Please enter a driver number: '\n' Press the 1 button to start installation of nVidia GeForce 9800GT 512MB Driver '\n' or '\n' Press the 2 button to start installation of RealTek HD Audio 7.1 Card Driver ";
cin >> i;
cout << "The value you entered is "; << i;
cout << ". Opening installer file. ";
}
Last edited on
cout << "The value you entered is "; << i;

You don't need that ; after the "...

cout << "The value you entered is " << i;
Topic archived. No new replies allowed.