Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78992354
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
Sat, Aug 24, 04:19
Size
476 B
Mime Type
text/x-c
Expires
Mon, Aug 26, 04:19 (2 d)
Engine
blob
Format
Raw Data
Handle
20132313
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