Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a Basic Mathmatic Program in C++
#1
Well, I want to write a program to do a pretty simple function, using Visual C++ Microsoft 2008 Edition. However, first, I wanted to get the hang of what needs to be done to get any program to work, so I took one out of my book,
Code:
bool accept ()
{
    cout << "Do you want to proceed (y or n)?\b";

    char answer = 0;
    cin >> answer;

    switch (answer) {
        case 'y':
            return true;
        case 'n':
            return false;
        default:
            count << "I'll take that for a no. /n"
            return false;
    }
}

I typed it up in a new *.cpp file, and tried to debug. The debug option was grayed out, so I'm thinking I need to do more than just type up a file.
So, my question, how exactly do I get a simple program to work? D:
I have no idea how C++ works, lol, as this is my first real attempt at trying to make a program.

Please and thank you for your time. Big Grin
*Is half away at 9:30 in the morning and has made weird typos like spelling "done" as "dun*

~~~~~~~~~~~~~
I tried compiling with the Command Prompt, that's what I got from the Help tab, and got these errors.
Code:
C:\Program Files\Microsoft Visual Studio 9.0\vc\bin>cl /EHsc BoolAccPro.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

BoolAccPro.cpp
BoolAccPro.cpp(3) : error C2065: 'cout' : undeclared identifier
BoolAccPro.cpp(6) : error C2065: 'cin' : undeclared identifier
BoolAccPro.cpp(14) : error C2065: 'count' : undeclared identifier
'return'

How do I declare the identifiers? ._.
Reply


Messages In This Thread
Creating a Basic Mathmatic Program in C++ - by Hazzy - 2008-07-03, 11:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)