Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63618955
string.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 21, 09:49
Size
476 B
Mime Type
text/x-c
Expires
Thu, May 23, 09:49 (2 d)
Engine
blob
Format
Raw Data
Handle
17796328
Attached To
R9360 PCSC_git
string.cpp
View Options
#include <iostream>
#include <string>
int main(int argc, char *argv[]) {
std::string city; // note the std::
city = "Oxford"; // note the double quotation marks
std::cout << "String length = " << city.length() << "\n";
std::cout << "Third character = " << city.at(2) << "\n";
std::cout << "Third character = " << city[2] << "\n";
// Prints the string in city
std::cout << city << "\n";
// Also prints city
std::cout << city.c_str() << "\n";
return 0;
}
Event Timeline
Log In to Comment