#include <iostream>
#include <string>
#include <ctime>
#include <sapi.h>
usingnamespace std;
//type something in to have it spoken!
//enter quit to exit
int main(int argc, char* argv[])
{ std::string Response[] = {
"HELLO",
"HOW ARE YOU?",
"BYE.",
"AWSOME.",
"SHAZAM!!!"
};
srand((unsigned) time(NULL));
std::string sInput = "";
std::string sResponse = "";
int nSelection =0;
srand((unsigned) time(NULL));
while(1) {
std::cout << ">";
std::getline(std::cin, sInput);
nSelection = rand() % 5;
sResponse = Response[nSelection];
std::cout << sResponse << std::endl;
if(sInput == "q") //a way to break the loop !
{ std::cout << "CYA LATER XD";
break;
}
}
char temp;
cin >> temp; //simple pause before exiting
return 0;
}
i'm stuck on it ...any help will make my day ! I WANT MY PC SAY SOMETHING
the problem is it's always error in sapi.h header file..
i don't wanna code in visual because my pc is too weak ...so if you can give me a code that i can build success you will be my guardiance
#include<windows.h>
#include <Servprov.h> // for IServiceProvider
MSDN is the best location to find solutions to compiler and linker errors, for example, whenever you get such linker error (for any windows API), try looking for that API in MSDN, it has details of header file and library file you need to use, for example following details are shown for CoInitialize on MSDN,
Quote Originally Posted by MSDN
1 2 3 4 5 6 7 8 9 10
Requirements
For an explanation of the requirement values, see Requirements (COM).
Windows NT/2000/XP: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in objbase.h.
Library: Use ole32.lib.
still get errors...nothing be fixed
i have no idea what API you was talking about
1/ does it make me fix my errors faster
2/ is it compatible with my codeblocks
3/ can we use it offline ? and where is the link,how to use