How to count how many (3, 10 appears in data?
I have done a little bit programming but abnormal program.

(3 , 10)
(3 , 31)
(3 , 51)
(3 , 71)
(3 , 78)
(3 , 97)
(3 , 105)
(3 , 113)
(3 , 135)
(3 , 138)

(3 , 9)
(3 , 30)
(3 , 50)
(3 , 71)
(3 , 77)
(3 , 97)
(3 , 106)
(3 , 112)
(3 , 135)
(3 , 138)


(3 , 10)
(3 , 31)
(3 , 51)
(3 , 71)
(3 , 78)
(3 , 97)
(3 , 106)
(3 , 113)
(3 , 135)
(3 , 138)


(3 , 15)
(3 , 36)
(3 , 56)
(3 , 71)
(3 , 83)
(3 , 97)
(3 , 105)
(3 , 118)
(3 , 135)
(3 , 138)


(3 , 15)
(3 , 36)
(3 , 56)
(3 , 71)
(3 , 83)
(3 , 97)
(3 , 106)
(3 , 118)
(3 , 135)
(3 , 138)


(3 , 10)
(3 , 31)
(3 , 51)
(3 , 71)
(3 , 78)
(3 , 97)
(3 , 106)
(3 , 113)
(3 , 135)
(3 , 138)

int mycount;
            int k; 
			int myints[] = {students.at (i).examcode.at(0),students.at(i).examcode.at(k)};
 			mycount = (int) count (myints, myints+12, 1);
  
			for ( int i = 0 ; i < students.size (); i++ )
			for ( int k = 0+1;k<students.at(i).examcode.size(); k++ )
			cout << "1" << mycount <<"  \n";

If this data appears in a .txt file you could read the .txt file line by line and pass (3, 10) to a string. When having these contents in the string you could make another string:

std::string Value = "(3, 10)";

From here you could compare Value with the lines you are reading and do a
count = (count + 1).

How to count how many (3, 10 appears in data?
I have done a little bit programming but abnormal program.

int mycount;
            int k; 
			int myints[] = {students.at (i).examcode.at(0),students.at(i).examcode.at(k)};
 			mycount = (int) count (myints, myints+12, 1);
  
			for ( int i = 0 ; i < students.size (); i++ )
			for ( int k = 0+1;k<students.at(i).examcode.size(); k++ )
			cout << "1" << mycount <<"  \n";

nurulshidanoni, start formatting your code better. I have lost count of how many times you have been asked to do this, but your code has such bizarre spacing that code tags, which are there in part to preserve formatting, are little help. I know you program in Windows. Get Visual Studio Express. It's free and it has an easy to use formatting feature that lines everything up so it's easy to read. I don't know what IDE you use, but your tabs are like 15 spaces, which is overkill and makes everything hard to read since it consistently overflows to the next line. A tab of 5 spaces is plenty.

Is it like this? I dont know how to make count statement.

{
ifstream stream1 ("STA83STU.txt");
if ( !stream1 )
stream1.close (); 
std::string Value = "(3, 10)";
//From here you could compare Value with the lines you are reading and do a count = (count + 1). 
using std::string;// Now we can just say "string".

int count;

count = 0;
count= count+1;
std::cout <<  count << "\n"; // Prints 
    
return 0;
 }

I dont know how to do , because I want to declare students.at (i).examcode.at(0),students.at (i).examcode.at(k)";
not only (3,10) only.

std::string Value1 = "students.at (i).examcode.at(0),students.at (i).examcode.at(k)";
 using std::string;// Now we can just say "string".
     for ( int m= 1; m<students.at i).examcode.size(); m++)

 if(students.at (i).examcode.at(0)=m,students.at (i).examcode.at(k));
  {
 cout <<count++<<" ";
  else 

 }
This article has been dead for over six months. Start a new discussion instead.