How to convert this algo into c++?

while 9more students)
read studentID
countexam =0
while(more examination)
read exam code
ExamID = GetExamID (examcode)
Incerement Count exam
examlist[count exam]=ExamID;
endwhile
for (i=1,to CountExam-1) do
for (j=i to CountExam) do
if (i!=j)
Inceremnt conflict value of row exam List[i] and column Examlist[j]
endwhile

Recommended Answers

All 2 Replies

Where is your attempt at it? You should know by now we won't do the work for you.

#include <iostream>
#include <algorithm>
#include "Student.h"
#include "iostream.h"

using namespace std;


//global variables

const int max = 140;

struct student;
{
int StudentID;
int ExamCode;
int studentlist;
};

int main(void) {

studentlist[max];// index range: 0 to 140
StudentID;
int n=0;//number of enrolments stored in a list

void readdata ( StudentID [], int &); //note the array syntax
//reads n data into an array of type of student


void readExamCode ( ExamCode [], int &); // note the array syntax
//reads n data into an array of type of student

void ouputdata const Student [], int);
//prints an array of type ( studentId, ExamCode )

voidmain()
{
	readdata (list,n);
	outputdata (list, n);

//These are the functiond DEFINITIONS

	void readdata ( StudentID[],int & n)
	{
		cout<<"Enter data--one student per line--end with CTRL-Z"<<endl;
		while ( cin>>data.studentid>>data.examcode)
		{
			n++;   //note final array contains n+1 exams
			list [n-1] exams;
		}
	}

void outputdata (const studentId[],int n)
{
	cout <<"examcode and stidentid:<<endl;
		for (int i=1; i<=n; i++) 






  }

}const int ID_MAX = 999999;  // every student ID number is smaller
                                            // than 999999
  int id_number;  // student ID number
  float score;    // student score on Exam 1
  float average;  // average of all student Exam 1 scores

  ...

  cin >> id_number >> score;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.