[ create a new paste ] login | about

Link: http://codepad.org/K5GU2C7T    [ raw code | output | fork ]

C, pasted on May 19:
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	string s;
	fflush(stdin); // Xóa bộ nhớ đệm
	cout << "\nMoi ban nhap vao chuoi: ";
	getline(cin, s);

	cout << "\nChuoi vua nhap la: " << s;

	// tính độ dài
	
	int dodai = s.length();
	
	string a = "Son", b = "dep trai";
	a += b; // Nối chuỗi b vào sau chuỗi a
	cout << a;

	if (a == b)
	{
  
	}
	else if (a > b)
	{

	}
	else if (a < b)
	{

	}

	string s1;
	s1 = "Nam Son";

	_strrev((char *)s1.c_str());
	cout << "\n\ns1 = " << s1;

	string s2 = "Nguyen Viet Nam Son";

	_strlwr((char *)s2.c_str()); 
	cout << "\n\ns2 = " << s2;

	_strupr((char *)s2.c_str());
	cout << "\n\ns2 = " << s2;

	string s3 = "Nam Son";
	string s4 = s3.substr(2, 4);
	cout << "\n\ns4 = " << s4;


	system("pause");
	return 0;
}


Output:
Line 18: error: iostream: No such file or directory
Line 16: error: string: No such file or directory
Line 19: error: algorithm: No such file or directory
Line 5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
In function 'main':
Line 9: error: 'string' undeclared (first use in this function)
Line 9: error: (Each undeclared identifier is reported only once
Line 9: error: for each function it appears in.)
Line 9: error: expected ';' before 's'
Line 11: error: 'cout' undeclared (first use in this function)
Line 12: error: 'cin' undeclared (first use in this function)
Line 12: error: 's' undeclared (first use in this function)
Line 20: error: expected ';' before 'a'
Line 21: error: 'a' undeclared (first use in this function)
Line 21: error: 'b' undeclared (first use in this function)
Line 37: error: expected ';' before 's1'
Line 38: error: 's1' undeclared (first use in this function)
Line 43: error: expected ';' before 's2'
Line 45: error: 's2' undeclared (first use in this function)
Line 51: error: expected ';' before 's3'
Line 52: error: expected ';' before 's4'
Line 53: error: 's4' undeclared (first use in this function)


Create a new paste based on this one


Comments: