#include <iostream> #include <string> using namespace std; int main() { string ch; cin>>ch; switch(ch) { case "1": { // do something here } } system("Pause"); return 0; }
#include <stdafx.h> #include <sapi.h> int main(int argc, char* argv[]) { ISpVoice * pVoice = NULL; if (FAILED(::CoInitialize(NULL))) return FALSE; HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice;); if( SUCCEEDED( hr ) ) { hr = pVoice->Speak(L"Hello world", 0, NULL); pVoice->Release(); pVoice = NULL; } ::CoUninitialize(); return TRUE; }
switch
char ch; cin >> ch; switch (ch) { case '1': // do something here break; }
if - else [if]
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice); // removed semicoln aftger pVoice
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)