[ create a new paste ] login | about

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

yifan666 - C, pasted on Aug 10:
#include<iostream>
#include<string>

using namespace std;

int main(){
	freopen("StringCpp.txt", "r", stdin);
//	int  tCase;
//	string  N;
//		cin >> tCase;
//	cin >> N;
//	cin.ignore();
//	cout << tCase << " " << N<<endl;
//	cin.ignore();

	char a[10][10];
	for(int i=0; i<10; i++){
	//	string s;
		cin>> a[i];

	}
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++){
			cout << a[i][j];
		}
		cout << endl;
		
	}

//	for(int test_case = 0; test_case < tCase; test_case++){
//		
//	//		cin.ignore();
//		string s;
//	//	fflush(stdin);
//		getline(cin, s);
//	//	cin >> s;
//
//		
//		int count = 0;
//		for(int i = 0; i<s.length(); i++){
//			if(s[i]==N[0]){
//				int k = i+1;
//				int jcount = 1;
//				for(int j = 1; j< N.length(); j++){
//					if(s[k] == N[j])	jcount++;
//					else break;
//					k++;
//				}
//				if(jcount == N.length())
//					count++;
//			}
//		}	
//	
//		cout << "s = "<< s <<endl<< "count = " << count <<endl;
//	}
	
	
//	jfswegjhghkwrejhghihwefi hyefjhgihefi
//jfswegjh ghkwrej hg hihwefi hyefjhgihefi
//jfswegjhghkwrejhghihwefi hyefjhgihefjhg
//jhgfswegjhghkwrejhghihwefi hyefjhgihefi
	

//	string output_string = "I'm learning C++ programming language";
//	cout << output_string << endl;
	
//	string name;
//	getline( cin, name );
//	cout << name << endl;
//	
//	string str;
//	cout << "Enter a string (end by a dot): " << endl;
//	getline(cin, str, '.');
//	cout << str << endl;
//		
//	string str1 = "Learn from others people";
//	for(int index = 0; index <= str1.length() - 1; index++)	{
//		cout << str1[index] << " ";
//	}
//	
//	 string st2 = "ad fg hj";
//	 string st3;
//	 st3 = "ad fg hj";
//	 string st4 = "ad fg hJ";
//	 cout << st2.compare(st3) << st2.compare(st4) ; // = 0: equal,  !=0: not equal
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Line 18: error: iostream: No such file or directory
Line 16: error: string: No such file or directory
Line 4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
In function 'main':
Line 17: error: 'for' loop initial declaration used outside C99 mode
Line 19: error: 'cin' undeclared (first use in this function)
Line 19: error: (Each undeclared identifier is reported only once
Line 19: error: for each function it appears in.)
Line 22: error: redefinition of 'i'
Line 17: error: previous definition of 'i' was here
Line 22: error: 'for' loop initial declaration used outside C99 mode
Line 23: error: 'for' loop initial declaration used outside C99 mode
Line 24: error: 'cout' undeclared (first use in this function)
Line 26: error: 'endl' undeclared (first use in this function)


Create a new paste based on this one


Comments: