在c ++中创建一个if else语句

时间:2016-03-25 11:22:46

标签: c++

我是C编程语言的全新手。我试图用以下代码创建一个if语句,但我不知道如何去做。我需要“producerHelper.SetPrefix(”/ myprefix1“)”来做另一个命令。任何帮助将不胜感激,谢谢。

bool (producerHelper.SetPrefix("/myprefix")) = True;  
if ( True )
{
 producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc720"));
}
else
{
producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc360"));
}

1 个答案:

答案 0 :(得分:1)

我想你想要的是这个:

bool res = producerHelper.SetPrefix("/myprefix");  
if ( res )
{
 producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc720"));
}
else
{
producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc360"));
}
相关问题