[ create a new paste ] login | about

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

C, pasted on May 19:
#include<iostream>  // thư viện nhập xuất
#include<cstdlib>   // thư viện để nhập số ngẫu nhiên
#include<time.h>   // thư viện thời gian
#include<string>   //thư viện string 

using namespace std;
void CauA()
{

}
void CauB()
{
	bool Choi_Lai = true;

	while (Choi_Lai == true)
	{
		srand(time(NULL));
		int So = rand() % 100 + 1;

		bool Doan_Trung = false;
		int So_Doan;
		int Dem_Thu = 1;
		int Gioi_Han;

		cout << "Nhap gioi han: ";
		cin >> Gioi_Han;

		while (Doan_Trung == false && Dem_Thu <= Gioi_Han)
			
		{
			if (Dem_Thu == 1)
			{
				cout << "Nguoi choi nhap so: ";
			}
			else
			{
				cout << "\nSo nhap vao khong dung. Xin moi nhap lai!\n";
			}
			cin >> So_Doan;

			if (So_Doan == So)
			{
				cout << "Chuc mung! Ban da doan trung so trong " << Dem_Thu << " Lan" << endl;
				Doan_Trung = true;
			}
			else
			{
				Dem_Thu++;
				if (So_Doan < So)
				{
					cout << "So ban vua nhap nho hon so may da chon. ";
				}
				else
				{
					cout << "So ban vua nhap lon hon so may da chon. ";
				}
			}
		}
		
		string Lua_Chon;
		cout << "Ban da nhap du so lan quy dinh. Nhan Y de choi lai hoac nhan phim bat ky de ket thuc : ";
		cin >> Lua_Chon;
		if (Lua_Chon != "Y" && Lua_Chon != "y")
		{
			Choi_Lai = false;
		}
	}
}
	int main()
	{
		CauB();
		
	return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Line 48: error: iostream: No such file or directory
Line 66: error: cstdlib: No such file or directory
Line 40: error: string: No such file or directory
Line 6: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
In function 'CauB':
Line 13: error: 'bool' undeclared (first use in this function)
Line 13: error: (Each undeclared identifier is reported only once
Line 13: error: for each function it appears in.)
Line 13: error: expected ';' before 'Choi_Lai'
Line 15: error: 'Choi_Lai' undeclared (first use in this function)
Line 15: error: 'true' undeclared (first use in this function)
Line 20: error: expected ';' before 'Doan_Trung'
Line 25: error: 'cout' undeclared (first use in this function)
Line 26: error: 'cin' undeclared (first use in this function)
Line 28: error: 'Doan_Trung' undeclared (first use in this function)
Line 28: error: 'false' undeclared (first use in this function)
Line 43: error: 'endl' undeclared (first use in this function)
Line 60: error: 'string' undeclared (first use in this function)
Line 60: error: expected ';' before 'Lua_Chon'
Line 62: error: 'Lua_Chon' undeclared (first use in this function)


Create a new paste based on this one


Comments: