static void client() { log4cxx::NDC ndc("client"); ORWELL_LOG_INFO("client ..."); zmq::context_t aContext(1); usleep(1 * 1000); ORWELL_LOG_INFO("create pusher"); Sender aPusher("tcp://127.0.0.1:9000", ZMQ_PUSH, orwell::com::ConnectionMode::CONNECT, aContext); ORWELL_LOG_INFO("create subscriber"); Receiver aSubscriber("tcp://127.0.0.1:9001", ZMQ_SUB, orwell::com::ConnectionMode::CONNECT, aContext); usleep(1 * 1000); ExpectGameState(false, aSubscriber); Hello aHelloMessage; aHelloMessage.set_name("playername"); RawMessage aMessage("randomid", "Hello", aHelloMessage.SerializeAsString()); aPusher.send(aMessage); ExpectGameState(true, aSubscriber); aPusher.send(aMessage); ORWELL_LOG_INFO("quit client"); }
QWidget * HelloWorldPlugin::createWidgetPlugin(QWidget *parent, const char *name) { Hello *hello = new Hello(pluginWindow()->caption(), parent, name); hello->setFont(QFont("times",14,QFont::Bold) ); hello->setBackgroundColor(Qt::black); return hello; }
int main(int argc, char *argv[]) { Test *test = new Test; SOM_Test(!strcmp(test->somGetClassName(),"Test")); SOM_Test(test->somRespondsTo(somIdFromString("hello_")) == 1); SOM_Test(!strcmp(test->hello_(),"Hello World")); SOM_Test(test->somRespondsTo(somIdFromString("mello_")) == 1); SOM_Test(!strcmp(test->mello_(),"Mello World")); SOM_Test(test->somGetClass()->somRespondsTo(somIdFromString("HelloCreate")) == 1); Hello *a = ((M_Hello*) (test->somGetClass()))->HelloCreate("Hello from A"); SOM_Test(!strcmp(a->hello_(),"Hello from A")); SOM_Test(test->somGetClass()->somRespondsTo(somIdFromString("MelloCreate")) == 1); Mello *b = ((M_Mello*) (test->somGetClass()))->MelloCreate("Mello from B"); SOM_Test(!strcmp(b->mello_(),"Mello from B")); Hello *c = (Hello*) (test->somGetClass()->somNew()); Mello *d = (Mello*) (test->somGetClass()->somNew()); SOM_Test(!strcmp(c->hello_(),"Hello World")); SOM_Test(!strcmp(d->mello_(),"Mello World")); printf("Derived Metaclass Test Successfully Completed.\n"); return 0; }
TEST( HelloWorld_test, Say ) { MockMsg msg; EXPECT_CALL( msg, get_msg() ) .WillOnce(Return("Hola!")); Hello saludador; saludador.say(&msg); }
int main() { Hello *h = new Hello(); h->setFormal(true); h->greeting(); delete h; return 0; }
int main () { Hello h; h.PrintHello (); return 0; }
void Regist::OnClickedRegistCancel() { Hello dlg; fatherflag = 1; ShowWindow(SW_HIDE); dlg.DoModal(); ShowWindow(SW_SHOW); // TODO: 在此添加控件通知处理程序代码 }
int main(){ std::cout << "Hello World!" << std::endl; std::cout << "C++ Data Structures!" << std::endl; Hello hello; hello.printHello(); return 0; }
void Manager::OnClickedManagerLogout() { Hello dlg; CurrentUser = ""; fatherflag = 1; ShowWindow(SW_HIDE); dlg.DoModal(); ShowWindow(SW_SHOW); // TODO: 在此添加控件通知处理程序代码 }
int main() { setlocale(0, ""); Hello h; h.World(); h.Everybody(); return 0; }
static jstring Hello_stringFromJNI(JNIEnv* env,jobject thiz) { Hello* he = (Hello*)env->GetIntField(thiz,helloFieldID); if(he == NULL) return NULL; char* jni_str = (char*)he->stringFromJNI(); size_t size = strlen(jni_str); jchar* data = UTF8toUTF16((char*)jni_str,&size); jstring str = env->NewString(data,size); free(data); return str; }
static jint Hello_calculate(JNIEnv* env,jobject thiz,jstring calculate,jint math,jint math2) { Hello* he = (Hello*)env->GetIntField(thiz,helloFieldID); if(he == NULL) return -1; const jchar* cal = env->GetStringChars(calculate,NULL); jsize cal_size = env->GetStringLength(calculate); char* cal2 = UTF16toUTF8((jchar*)cal,(size_t*)&cal_size); int result = he->calculate(cal2,math,math2); env->ReleaseStringChars(calculate,cal); free(cal2); return (jint)result; }
int main(int argc, const char * argv[]) { Hello *h = new Hello(); h->sayHello("ZhangSan"); // std::string name = "ZhangSan"; // h->sayHello((char*)name.c_str()); // insert code here... std::cout << "Hello, World!\n"; return 0; }
int main(int argc, const char * argv[]) { Hello *h = new Hello(); // C写法 // h->sayHello("Lance"); // std::string name = "Lance"; // 转成C类型的字符串,这样就不会警告了。 // h->sayHello((char *)name.c_str()); // C++写法 h->sayHello("Lance"); return 0; }
int main() { Talker t; t.SaySomething(); Hello h; h.SaySomething(); World w; w.SaySomething(); //Now lets have some polymorphism !!! cout << "Polymorphic Hello World" << endl; vector<Talker *> talkers(2); talkers.at(0) = new Hello(); talkers.at(1) = new World(); for (int i = 0; i < talkers.size(); i++) { talkers.at(i)->SaySomething(); } }
void Regist::OnClickedRegistRegist() { CDatabase db; db.Open("bankmanagement"); CString sqlstr;//,username,idcard,pwd,address,email,number; UpdateData(TRUE);//更新文本框变量 //MessageBox(m_RegUsername); sqlstr.Format(_T("insert into user(user_name,user_idcard,user_pwd,user_address,user_email,phone_number) values('%s','%s','%s','%s','%s','%s')"), m_RegUsername, m_RegIdcard, m_RegPwd, m_RegAddress, m_RegEmail, m_RegPhone); if (m_RegUsername.IsEmpty() || m_RegPwd.IsEmpty() || m_RegPwdConfirm.IsEmpty() || m_RegIdcard.IsEmpty() || m_RegAddress.IsEmpty() || m_RegEmail.IsEmpty()) { MessageBox("带*为必填项", "输入有误"); } else if (m_RegUsername == "用户名为字母与数字组合") { MessageBox("用户名未修改"); } else if (m_RegPwd.GetLength() < 6) { MessageBox("密码太短!","输入有误"); } else if (m_RegPwd != m_RegPwdConfirm) { MessageBox("输入密码不一致", "输入有误"); } else { db.ExecuteSQL(sqlstr); db.Close(); MessageBox("注册成功!返回登录。"); //this->GetParent()->SendMessage(WM_CLOSE);//关闭父对话框 Hello dlg; fatherflag = 1; ShowWindow(SW_HIDE); dlg.DoModal(); ShowWindow(SW_SHOW); } // TODO: 在此添加控件通知处理程序代码 }
void main(void) { int in, out = 0; printf("Hello, FPGA world!\n"); do { OUTB(IO_LED, out); out++; hello_global.message(); INB(in, IO_PUSHBTN); } while (in == 0); }
int main(int argc, char ** argv) { Hello hello ("Pepito"); hello.sayHello(10); return 0; }
int main( int argc, char**argv){ Hello hello; hello.print_var(); return 0; }
int main(int argc, char *argv[]) { Hello h; h.print(); return 0; }
/** * Set the number of times the task should run. * @param L Pointer to the Lua state. * @return Number of elements being passed back through the Lua stack. */ static int set_ntimes(lua_State *L) { Hello *p = luaW_check<Hello>(L, 1); p->set_ntimes(luaL_checknumber(L, 2)); return 0; }
int main(int argc, char const *argv[]) { Hello hello; std::string msg = hello.sayHello(); std::cout << msg; return 0; }