[ create a new paste ] login | about

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

C++, pasted on Nov 14:
#include <iostream>
using namespace std;
const int n=50;
 class reshte
 {

	 char s[50];
	 char *s;
	 char x;
	 int c;
 public:
	 void input();
	 void calc();
	 reshte();
	 void show();
 };
 void reshte::input()
 {
	 cin.get(s,50);
	 cin>>x;
 }
 reshte::reshte()
 {
	 c=0;
 }
 void reshte::calc()
 {
	 while (*s)
	 {
		 if (*s==x)
		 {
			 c++;
			 s++;
		 }
	 }
 }
 void reshte:: show()
 {
	 cout<<c;
 }
 int main()
 {
	 int i;
	 reshte myreshte[n];
	 for (int i=0;i<50;i++)
	 myreshte[i].input();
	 myreshte[i].calc();
	 myreshte[i].show();
 }


Output:
1
2
Line 8: error: declaration of 'char* reshte::s'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: