Computers |
|
| | #1 (permalink) |
| Newb Techie | Hey I am doing this tutorial for a program for class, I know nothing of C++ so bear with me. This project is set to create console application. Here is the code /* '01 Main.cpp' */ #include <stdafx.h> main (void) { /* Variable declarations*\ unsigned char Age; long StartEnergy; char CharacterType; /* Get the Information *\ std::cout << "What is your Character's Age?: "; std::cin >> Age; std::cout << "How much start Energy?: "; std::cin >> Start Energy; std::cout << " Character Race?: "; std::cin >> Character Race; /*Show the information*\ std::cout << "Your chacter is " << Age << " years old." << std::endl; std::cout << "Has " << StartEnergy << " of starting energy." << std::endl; std::cout << "And its race is " << CharacterType << *.* << std::endl; return 0; } Ok now whenever I go to Debug or Run it it just says "filename.exe not found" Well how do I get to preview my little text program? or run it period for that matter. |
| | |
| | #3 (permalink) |
| Super Techie Join Date: Jul 2004
Posts: 375
| I see some syntax errors.
__________________ AMD 3800+ X2 Zalman CNPS7000B CPU Heatsink/Fan ASUS A8N Premium 2 GB G. Skill DDR 400 (2 X 1 GB) 1 GB Ultra DDR 400 (2 X 512 GB) eVGA 7800GT 256MB 120 GB seagate HD (7200RPM) 80 GB Seagate HD (7200RPM) Sound Blaster Audigy 2 Platium ZS Sound Card Logitec z5300 5.1 THX certified speaker Medusa 5.1 Headphones ATI TV turner card DVD Drive CD Burner Drive Razer Copperhead Gaming mouse |
| | |
| | #4 (permalink) |
| Newb Techie | I an using Visual Studio 2005. I am not sure about a compiler. I mean I shouldnt have to compile this just to see it, its just a text dos console. Basically just like the simple Hello world tutorial. Which does run by the way. As for second poster. Can you be more specific what syntax error do you see? VS doesn't seem to say there are any. And the code is taken straight from a college text book word for word... |
| | |
| | #5 (permalink) |
| Monster Techie | Don't know why I didn't see this the first time--this is most likely the problem: Your comments: /* '01 Main.cpp' */ /* Variable declarations*\ /* Get the Information *\ /*Show the information*\ Open: /* Close: */ And since after the variable declaration comment, the comment is never closed--well, there's no program there. ![]() So it should be: Code: /* '01 Main.cpp' */
#include <stdafx.h>
main (void)
{
/* Variable declarations*\
unsigned char Age;
long StartEnergy;
char CharacterType;
/* Get the Information */
std::cout << "What is your Character's Age?: ";
std::cin >> Age;
std::cout << "How much start Energy?: ";
std::cin >> Start Energy;
std::cout << " Character Race?: ";
std::cin >> Character Race;
/*Show the information */
std::cout << "Your chacter is " << Age << " years old." << std::endl;
std::cout << "Has " << StartEnergy << " of starting energy." << std::endl;
std::cout << "And its race is " << CharacterType << *.* << std::endl;
return 0;
} As well, if there are other syntax errors, now VS should tell you. |
| | |
| | #8 (permalink) |
| Newb Techie | Thank you yea I found a couple other errors too but got it working. In my book for school it says #include <stdafx.h> However I got tan error saying not found. When I switched it to #include <iostream> it worked fine. What is stdafx.h and why does my college book use that? |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |