// Beeper.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
unsignedint intFre, intDur;
char chrAns;
system("COLOR 02");
system("TITLE Beeper by CometJack");
do
{
std::cin.clear();
system("CLS");
std::cout << "Welcome to the Beeper application by CometJack!" << std::endl;
std::cout << "Please type in how high you want the beep to sound." << std::endl;
std::cin >> intFre;
system("CLS");
std::cout << "Please type in how long you want to hear the beep sound." << std::endl;
std::cin >> intDur;
system("CLS");
std::cout << "Beeping freequency set at " << intFre << " milliseconds" << " & " << "beeping duration set at " << intDur <<" milliseconds." << std::endl;
Beep(intFre, intDur);
system("CLS");
std::cout << "Enter Y to restart or press another key to exit." << std::endl;
std::cin >> chrAns;
} while (chrAns == 'Y' || chrAns == 'y');
return 0;
}
I am trying to replace std::cin >> with std::cin.getLine(); although I don't know how to get it working :( I want the program to be able to tell if it's the correct data type going into a variable so it doesn't crash when someone types the wrong data type. Help please :(
Also there is no string in my compiler, I try string strInput;
and get errors saying there is no string class or something :( I am using MS Studio Express Edition 2008.
Okay thanks, also yes I have #include <string>
near the top and I tried string strTest;
and I got 1>c:\users\cometjack\documents\visual studio 2008\projects\beeper\beeper\beeper.cpp(14) : error C2065: 'string' : undeclared identifier