Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120671289
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
Sun, Jul 6, 04:20
Size
476 B
Mime Type
text/x-c
Expires
Tue, Jul 8, 04:20 (2 d)
Engine
blob
Format
Raw Data
Handle
27226535
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