Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

String

Introduction to String Data Type in C++
by

Alhassan Nageh

on 1 December 2012

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of String

Big Integer Agenda String Manipulation Presenter: Alhassan Nageh
Email: AlhassanNageh@gmail.com Thanks!!! Introduction to String Input/Output String Operations on String Character Vs Integer string MyString;
cin >> MyString;
cout << MyString << "\n"; Reading with getline Reading with cin 2012 acmASCIS, Hello World :D. append erase insert substr find compare size string MyString = "Hello World, ";
string MyString2 = "acmASCIS'13";
cout << "The Size of MyString = " << MyString.size() << "\n";
MyString.append(MyString2);
cout << "The MyString after appending with MyString2 = " << MyString << "\n";
MyString.erase(5,6);
cout << "The MyString after erasing 6 elements from the 6th element = " << MyString << "\n";
cout << "The 8th element of MyString = " << MyString[7] <<"\n"; #include<iostream>
#include<string>
using namespace std;
int main()
{
string MyString("Hello "),
MyString2 = "World :D";
cout << MyString << MyString2 << "\n";
} //to use string, must include string library char Character = 64;
cout << Character << "\n"; Write a program that take two Integers x, y (x, y < 2^100) and print their sum, subtract, and multiply.
Sample Input:
12
10
45698756423658956454532256633215668552237855
22556348896634786324589632259885456332215888
Sample Output:
Case 1:
22
2
120
Sum:
Case 2:
68255105320293742779121888893101124884453743
23142407527024170129942624373330212220021967
1030797094034381556332192057726508571395384645493114980556932161010188390732253386040240 "123132"
"ABCDEFG"
"My Name is Ahmed."
"I have 2000$ :P." String string MyString("Hello ");
int MyStringSize = MyString.size();
cout << MyStringSize << "\n"; string MyString = "Hello Wolrd :D.";
string MyNewString = MyString.erase(11, 2);
cout << MyNewString << "\n"; string MyString("Hello ");
string MyNewString = MyString.append("acmASCIS");
cout << MyNewString << "\n"; string MyString("Hello 2013");
string MyNewString = MyString.insert(6, "acmASCIS");
cout << MyNewString << "\n"; string MyString("Hello 2013");
int value = MyString.compare(0, 2, "acmASCIS", 0, 2);
cout << "The First two letters from MyString are ";
if(value == 0)
cout << "same.\n";
else if(value < 0)
cout << "come before.\n";
else if(value > 0)
cout << "come after.\n"; string MyString("Hello acmASCIS 2013");
string MyNewString = MyString.substr(6, 8);
cout << MyNewString << "\n"; string MyString("Hello acmASCIS 2013");
int Index = MyString.find('Z');
cout << Index << "\n"; char Character1 = 49;
char Character2 = 51;
string MyString;
MyString = 97;
MyString += 99;
MyString += 109;
cout << MyString << " " << Character1 << Character2 << "\n"; string MyString;
getline(cin, MyString);
cout << MyString << "\n"; Why we use String?!!!!!!!!!
Full transcript