本文整理汇总了C++中s3函数的典型用法代码示例。如果您正苦于以下问题:C++ s3函数的具体用法?C++ s3怎么用?C++ s3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s3函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_operator_index
void test_operator_index() {
cout << "Testing operator [] and reverse()" << endl;
cout << "--------------------------------------------" << endl;
String s = "hello";
String s2 = "good";
String s3("helloworld");
String s4("class");
cout << "operator []: s[1] from \"hello\" = " << s[1] << endl;
cout << "operator []: s[4] from \"hello\" = " << s[4] << endl;
cout << "Testing reverse(): \"helloworld\" = " << s3.reverse() << endl;
cout << "Testing reverse(): \"class\" = " << s4.reverse() << endl;
cout << "--------------------------------------------" << endl << endl;
}
开发者ID:mahamadousylla,项目名称:ICS-45C,代码行数:15,代码来源:string_test.cpp
示例2: constuctors
void constuctors()
{
/* MemStat memStat("constructors"); */
String s1, s2((Size_T)(55)), s3("12345", 4), s4("12345"), s5('x');
String s6('x', 27);
cout << "constructors" << endl;
s2 = "123";
assert(s1.length() == 0);
assert(s2.length() == 3);
assert(s2.reserve() > s2.length());
assert(s3.length() == 4);
assert(s4.length() == 5);
assert(s5.length() == 1 && s5.getAt(0) == 'x');
assert(s6.length() == 27 && s6.getAt(26) == 'x');
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:16,代码来源:strtest.c
示例3: s1
void StringTest::testCStr()
{
cxxtools::String s1(L"abc");
CXXTOOLS_UNIT_ASSERT(s1.c_str()[0] == 'a' && s1.c_str()[1] == 'b' && s1.c_str()[2] == 'c' && s1.c_str()[3] == '\0');
cxxtools::String s2;
CXXTOOLS_UNIT_ASSERT(s2.c_str()[0] == '\0');
cxxtools::Char abc[] = { 'a', 'b', 'c', '\0' };
cxxtools::String s3(abc);
CXXTOOLS_UNIT_ASSERT(s3.c_str()[0] == 'a' && s3.c_str()[1] == 'b' && s3.c_str()[2] == 'c' && s3.c_str()[3] == '\0');
cxxtools::Char zero[] = { '\0' };
cxxtools::String s4(zero);
CXXTOOLS_UNIT_ASSERT(s4.c_str()[0] == '\0');
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:16,代码来源:string-test.cpp
示例4: testConstruct
///////////////////////////////////////////////////////// Test /////
// test the different constructor and the c_str() method.
void testConstruct() {
StringBuffer s1;
CPPUNIT_ASSERT(s1.c_str() == NULL);
StringBuffer s2("");
CPPUNIT_ASSERT(strcmp(s2.c_str(), "") == 0);
StringBuffer s3("test");
CPPUNIT_ASSERT(strcmp(s3.c_str(), "test") == 0);
StringBuffer s4("0123456789", 4);
CPPUNIT_ASSERT(strcmp(s4.c_str(), "0123") == 0);
StringBuffer copy(s3);
CPPUNIT_ASSERT(strcmp(copy, s3) == 0);
}
开发者ID:ruphy,项目名称:kfunambol,代码行数:18,代码来源:StringBufferTest.cpp
示例5: main
int main(int argc, char *argv[])
{
std::string s1("the"), s2("Her"), s3("in");
const std::string file("text.txt");;
TextQuery tq;
std::ifstream fin(file.c_str());
tq.read_file(fin);
Query q = (Query(s1) & Query(s2)) | Query(s3);
std::set<TextQuery::line_no> set = q.eval(tq);
typedef std::set<TextQuery::line_no>::iterator iter_stq;
for( iter_stq iter= set.begin() ; iter != set.end() ; iter++ )
{
std::cout << tq.text_line(*iter) << std::endl;
}
return 0;
}
开发者ID:yuandaxing,项目名称:utils,代码行数:16,代码来源:Query.cpp
示例6: TEST
TEST(SimpleString, Concatenation)
{
SimpleString s1("hello!");
SimpleString s2("goodbye!");
SimpleString s3("hello!goodbye!");
SimpleString s4;
s4 += s1;
s4 += s2;
CHECK_EQUAL(s3, s4);
SimpleString s5("hello!goodbye!hello!goodbye!");
s4 += s4;
CHECK_EQUAL(s5, s4);
}
开发者ID:dhbw-fn-micro,项目名称:cpputest,代码行数:16,代码来源:SimpleStringTest.cpp
示例7: L_ERROR
void GenericRenderer::render(Renderable& buffer, CameraID camera, GPUProgram* program) {
if(!program) {
L_ERROR("No shader is bound, so nothing will be rendered");
return;
}
std::size_t index_count = buffer.index_data().count();
if(!index_count) {
return;
}
GLStateStash s2(GL_ELEMENT_ARRAY_BUFFER_BINDING);
GLStateStash s3(GL_ARRAY_BUFFER_BINDING);
buffer._update_vertex_array_object();
buffer._bind_vertex_array_object();
//Attributes don't change per-iteration of a pass
set_auto_attributes_on_shader(buffer);
set_auto_uniforms_on_shader(*program, camera, buffer);
//Render the mesh, once for each iteration of the pass
switch(buffer.arrangement()) {
case MESH_ARRANGEMENT_POINTS:
GLCheck(glDrawElements, GL_POINTS, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
case MESH_ARRANGEMENT_LINES:
GLCheck(glDrawElements, GL_LINES, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
case MESH_ARRANGEMENT_LINE_STRIP:
GLCheck(glDrawElements, GL_LINE_STRIP, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
case MESH_ARRANGEMENT_TRIANGLES:
GLCheck(glDrawElements, GL_TRIANGLES, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
case MESH_ARRANGEMENT_TRIANGLE_STRIP:
GLCheck(glDrawElements, GL_TRIANGLE_STRIP, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
case MESH_ARRANGEMENT_TRIANGLE_FAN:
GLCheck(glDrawElements, GL_TRIANGLE_FAN, index_count, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
break;
default:
throw NotImplementedError(__FILE__, __LINE__);
}
}
开发者ID:aonorin,项目名称:KGLT,代码行数:47,代码来源:generic_renderer.cpp
示例8: main
int main(int argc, char * argv[]){
Triangle t1(3,3,3,1,1);
Square s1(6,2,2);
Circle c1(7,3,3);
Sphere sp1(10,4,4,4);
Cube cu1(10,5,5,5);
Tetrahedron te1(5,6,7,8,9,10,6,6,6);
Cube cu2(5,7,7,7);
Square s2(16,8,8);
Circle c2(1,9,9);
Circle c3(55,10,10);
Square s3(3,11,11);
Tetrahedron te2(3,3,3,3,3,3,12,12,12);
Shape * arr = new Shape[12];
arr[0] = t1;
arr[1] = s1;
arr[2] = c1;
arr[3] = sp1;
arr[4] = cu1;
arr[5] = te1;
arr[6] = cu2;
arr[7] = s2;
arr[8] = c2;
arr[9] = c3;
arr[10] = s3;
arr[11] = te2;
for(int i = 0; i < 11; ++i){
cout << endl;
if(arr[i].getT() == 2){
cout << "2-D Shape Found" << endl;
cout << "Points are: (" << arr[i].getX() << ", " << arr[i].getY() << ")" << endl;
cout << "Area is: " << arr[i].getArea() << endl;
}
else{
cout << "3-D Shape" << endl;
cout << "At Pt: (" << arr[i].getX() << ", " << arr[i].getY() << ", " << arr[i].getZ() <<")" << endl;
cout << "Surface Area is: " << arr[i].getSurface() << endl;
cout << "Volume is: " << arr[i].getVolume() << endl;
}
}
delete[] arr;
return 0;
}
开发者ID:TCiras,项目名称:ComputingIII,代码行数:47,代码来源:shape.cpp
示例9: s1
void UnicodeTestCase::ConstructorsWithConversion()
{
// the string "Déjà" in UTF-8 and wchar_t:
const unsigned char utf8Buf[] = {0x44,0xC3,0xA9,0x6A,0xC3,0xA0,0};
const unsigned char utf8subBuf[] = {0x44,0xC3,0xA9,0x6A,0}; // just "Déj"
const char *utf8 = (char *)utf8Buf;
const char *utf8sub = (char *)utf8subBuf;
wxString s1(utf8, wxConvUTF8);
#if wxUSE_UNICODE
const wchar_t wchar[] = {0x44,0xE9,0x6A,0xE0,0};
CPPUNIT_ASSERT_EQUAL( wchar, s1 );
wxString s2(wchar);
CPPUNIT_ASSERT_EQUAL( wchar, s2 );
CPPUNIT_ASSERT_EQUAL( wxString::FromUTF8(utf8), s2 );
#else
CPPUNIT_ASSERT_EQUAL( utf8, s1 );
#endif
wxString sub(utf8sub, wxConvUTF8); // "Dej" substring
wxString s3(utf8, wxConvUTF8, 4);
CPPUNIT_ASSERT_EQUAL( sub, s3 );
#if wxUSE_UNICODE
wxString s4(wchar, wxConvUTF8, 3);
CPPUNIT_ASSERT_EQUAL( sub, s4 );
// conversion should stop with failure at pos 35
wxString s("\t[pl]open.format.Sformatuj dyskietk\xea=gfloppy %f", wxConvUTF8);
CPPUNIT_ASSERT( s.empty() );
#endif // wxUSE_UNICODE
// test using Unicode strings together with char* strings (this must work
// in ANSI mode as well, of course):
wxString s5("ascii");
CPPUNIT_ASSERT_EQUAL( "ascii", s5 );
s5 += " value";
CPPUNIT_ASSERT( strcmp(s5.mb_str(), "ascii value") == 0 );
CPPUNIT_ASSERT_EQUAL( "ascii value", s5 );
CPPUNIT_ASSERT( s5 != "SomethingElse" );
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:46,代码来源:unicode.cpp
示例10: main
int main()
{
while (true)
{
cout
}
D d1 = 1;
S s2("2");
try {
S s3("not a number");
} catch(const std::exception&) {}
std::cout << s2.getData() << '\n';
D d2(3, 4);
d2 = d1; // OK: assignment to lvalue
// D(5) = d1; // ERROR: no suitable overload of operator=
}
开发者ID:CCJY,项目名称:coliru,代码行数:17,代码来源:main.cpp
示例11: turnLeft
void turnLeft() {
// Take a left turn !!
int t=0, s=0;
//mvfwdpulse();
while((s1()==BLACK) | (s5()==BLACK))
fwd();
while(t==0 |s==0 | s3()==WHITE) {
left();
if(s5()==BLACK) t=1;
if(s1()==BLACK) s=1;
}
fwd();
curHead+=1;
curHead%=4;
// Left turn complete
}
开发者ID:anant90,项目名称:roboliga-finals,代码行数:17,代码来源:Autonomous.c
示例12: turnRight
//--------------------------------------------------------------------//
void turnRight() {
// Take a right turn !!
int t=0,s=0;
//mvfwdpulse();
while((s1()==BLACK) | (s5()==BLACK))
fwd();
while((t==0 | s==0) | s3()==WHITE) {
right();
if(s1()==BLACK) t=1;
if(s5()==BLACK) s=1;
}
fwd();
curHead+=3;
curHead%=4;
// Right turn complete
}
开发者ID:anant90,项目名称:roboliga-finals,代码行数:18,代码来源:Autonomous.c
示例13: s
void Test_M2MString::test_compare()
{
String s("name");
String s1("yeb");
String s2("name");
String s3("nam");
CHECK(s.compare(1,5, s1) < 0);
CHECK(s1.compare(0,5, s2) > 0);
CHECK(s.compare(0,4, s2) == 0);
CHECK(s.compare(0,4, s3) > 0);
CHECK(s.compare(1,5, "yeb") < 0);
CHECK(s1.compare(0,5, "name") > 0);
CHECK(s.compare(0,4, "name") == 0);
CHECK(s.compare(0,4, "nam") > 0);
}
开发者ID:GoodDada,项目名称:mbed-client,代码行数:17,代码来源:test_m2mstring.cpp
示例14: ACE_TMAIN
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
ACE_CString s1 ("hello");
ACE_CString s2 ("world");
ACE_CString s3 ("el");
ACE_NS_WString s4 ("hello");
ACE_NS_WString s5 ("world");
ACE_NS_WString s6 ("el");
ACE_ASSERT (s1 != s2);
ACE_ASSERT (s1.strstr (s2) == ACE_CString::npos);
ACE_ASSERT (s1.strstr (s2) == ACE_CString::npos);
ACE_ASSERT (s1.strstr (s3));
ACE_ASSERT (s4.strstr (s5) == ACE_NS_WString::npos);
ACE_ASSERT (s5.strstr (s6));
return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:18,代码来源:test_sstring.cpp
示例15: replace
void replace()
{
/* MemStat memStat("replace"); */
String s1("1234", 5), s2("abcd");
String s3("1235", 4), s4("1232");
String s5, s6;
cout << "replace" << endl;
assert(s1.length() == 5);
s6 = s1;
assert(s1.length() == 5);
assert(s6.length() == 5);
s1.replace(1, 2, s2);
assert(s1 == String("1abcd4", 7));
s2.replace(1,2, s2);
assert(s2 == String("aabcdd", 6));
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:18,代码来源:strtest.c
示例16: testWrite
void testWrite()
{
NS_STDEXT::WinRegWriteKey(HKEY_CURRENT_USER, WINX_TEST_KEY_)
.putDWord(WINX_TEXT("dword"), 123);
NS_STDEXT::WinRegWriteKey(HKEY_CURRENT_USER, WINX_TEST_KEY_)
.putGuid(WINX_TEXT("guid"), IID_IClassFactory);
NS_STDEXT::WinRegWriteKey(HKEY_CURRENT_USER, WINX_TEST_KEY_)
.putString(WINX_TEXT("string"), WINX_TEXT("abc"));
NS_STDEXT::WinRegWriteKey(HKEY_CURRENT_USER, WINX_TEST_KEY_)
.putString(WINX_TEXT("string2"), std::vector<TCHAR>(257, '!'));
std::basic_string<TCHAR> s3(WINX_TEXT("string3"));
NS_STDEXT::WinRegWriteKey(HKEY_CURRENT_USER, WINX_TEST_KEY_)
.putString(WINX_TEXT("string3"), s3);
}
开发者ID:Chingliu,项目名称:winx,代码行数:18,代码来源:main.cpp
示例17: TEST
TEST( CFPP_WriteStream, OperatorAssignAutoPointer )
{
CF::WriteStream s1;
CF::WriteStream s2( CF::URL( "file:///etc/hosts" ) );
CF::WriteStream s3( CF::URL( "file:///etc/hosts" ) );
ASSERT_FALSE( s1.IsValid() );
ASSERT_TRUE( s2.IsValid() );
ASSERT_TRUE( s3.IsValid() );
s1 = CF::AutoPointer( CFWriteStreamCreateWithFile( NULL, CF::URL( "file:///etc/hosts" ) ) );
s2 = CF::AutoPointer( CFUUIDCreate( NULL ) );
s3 = CF::AutoPointer( NULL );
ASSERT_TRUE( s1.IsValid() );
ASSERT_FALSE( s2.IsValid() );
ASSERT_FALSE( s3.IsValid() );
}
开发者ID:DigiDNA,项目名称:CFPP,代码行数:18,代码来源:Test-CFPP-WriteStream.cpp
示例18: main
// Don't forget you will need to edit/change this to make it look
// like our lab sheet for this week!
int main()
{
String s1("Test String1");
String s2("Test String 2");
String s3(s1);
s1.Display("HELP");
s2.Display();
s3.Display();
// Helping you out here :-) DON'T FORGET TO ADD THE REST FROM THE LAB AND REMOVE THESE //
// if(!s3)
// cout << "s3 is null\n";
// s1 = "";
//if(!s1)
// cout << "s1 is null\n;
return 0;
}
开发者ID:Lydiasaurus,项目名称:Personal,代码行数:20,代码来源:InLab6Driver.cpp
示例19: main
main()
{
Student s1("George","A");
Student s2("Arthur","D");
Student s3("Chester","C");
Student s4("Willy","B");
List<Student> Class(s1,s2,s3,s4);
// Class.print(cout) << "\n";
cout << Class << "\n";
Class.sort(name_compare);
// Class.print(cout) << "\n";
cout << Class << "\n";
Class.sort(grade_compare);
// Class.print(cout) << "\n";
cout << Class << "\n";
return 0;
}
开发者ID:seyko2,项目名称:cfront-3,代码行数:18,代码来源:Student.c
示例20: main
/**
* Simple program that starts our raytracer
*/
int main(int argc, char *argv[]) {
try {
RayTracer* rt;
Timer t;
rt = new RayTracer(800, 600);
std::shared_ptr<SceneObjectEffect> color(new ColorEffect(glm::vec3(0.0, 1.0, 0.0)));
std::shared_ptr<SceneObjectEffect> phong(new PhongEffect(glm::vec3(0.0, 0.0, 10.0)));
std::shared_ptr<SceneObjectEffect> steel(new SteelEffect());
std::shared_ptr<SceneObjectEffect> fresnel(new FresnelEffect());
std::shared_ptr<SceneObject> s1(new Sphere(glm::vec3(-3.0f, 0.0f, 6.0f), 2.0f, steel));
rt->addSceneObject(s1);
std::shared_ptr<SceneObject> s2(new Sphere(glm::vec3(3.0f, 0.0f, 3.0f), 2.0f, fresnel));
rt->addSceneObject(s2);
std::shared_ptr<SceneObject> s3(new Sphere(glm::vec3(0.0f, 3.0f, 9.0f), 2.0f, steel));
rt->addSceneObject(s3);
std::string path = "cubemaps/SaintLazarusChurch3/";
std::shared_ptr<SceneObject> cubeMap(new CubeMap(path + "posx.jpg", path + "negx.jpg",
path + "posy.jpg", path + "negy.jpg",
path + "posz.jpg", path + "negz.jpg"));
rt->addSceneObject(cubeMap);
std::shared_ptr<SceneObject> triangle(new Triangle(glm::vec3(0.0f, 2.0f, -1.0f),
glm::vec3(-2.0f, -2.0f, -1.0f), glm::vec3(2.0f, -2.0f, 0.0f), steel));
rt->addSceneObject(triangle);
t.restart();
rt->render();
double elapsed = t.elapsed();
std::cout << "Computed in " << elapsed << " seconds" << std::endl;
rt->save("test", "bmp"); //We want to write out bmp's to get proper bit-maps (jpeg encoding is lossy)
delete rt;
} catch (std::exception &e) {
std::string err = e.what();
std::cout << err.c_str() << std::endl;
return -1;
}
return 0;
}
开发者ID:Kris2ffer,项目名称:Avansert-OpenGL-innleveringer,代码行数:47,代码来源:main.cpp
注:本文中的s3函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论