Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- class MyString{
- string str;
- public:
- MyString(string s){
- str = s;
- if(sizeof(s) % 2 != 0){
- space();
- }
- }
- void space() {
- for(int i=0;i<sizeof(str);i++){
- cout << str[i];
- if(str[i] == ' '){
- break;
- }
- }
- }
- ~MyString(){
- str[0] = 0;
- }
- };
- int main() {
- char sentense[50];
- ifstream fin("file.txt");
- fin.getline(sentense, 50);
- fin.close();
- MyString str(sentense);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement