473,379 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

conflict matrix

nurulshidanoni
Dear all,

my algorith is like this

while(mor students)
read studentID
countexam=0
while (more examination)
read examcode
examID =get ExamID (examCode)
Incerement Count exam
Exam List [Count Exam]=ExamID
endwhile
for(i=1 to Count Exam-1) do
for (j=i to count exam) do
if (i!=j)
Increment conflict value of row Exam List [i] and column Exam LIst [j]
endwhile

And I have done a programming like below...
Expand|Select|Wrap|Line Numbers
  1. //Algorithm to create a conflict graph//
  2. #include <iostream>
  3. #include <iomanip>
  4. using std::cerr;
  5. using std::cout;
  6. using std::endl;
  7.  
  8. #include <fstream> // needed for files
  9. using std::ifstream;
  10. #include <cstdlib> // for exit function
  11.  
  12. using namespace std;
  13.  
  14. int main(void);
  15.  
  16. int readStudentID( int nStudents, int studentsids[], int ExamCode[] ); 
  17. void printStudentID( int total, int nStudents, int studentids[], int ExamCode[] );
  18.  
  19.     {    
  20.    ifstream indata; // indata is like cin
  21.    int num; // variable for input value
  22.    inFile.open("St.Andrews83exm.txt", ios::in); // opens the file
  23.    if(!indata) { // file couldn't be opened
  24.        {
  25. {  
  26.       const int nStudents = 139 ; // Program inefficient if nCourses is large!
  27.       int studentids[ nStudents ], ExamCode[ nStudents ];
  28.       int total = readStudentID( nStudents, studentids, ExamCode );
  29.  
  30.       printStudentID( total, nStudents, studentids, ExamCode );
  31.       return 0; // Error level of 0 means normal termination
  32.  
  33.       int readStudentID( int n, int ids[], int totals[] )
  34. {
  35.       int grandTotal = 0;
  36.       cout << endl 
  37.       << "For each of " << n << " students," << endl
  38.       << " enter the Student ID and the Examination Code."
  39.       << endl;
  40.  
  41.       for ( int i = 0; i < n; i++ )
  42. {
  43.       cout << "Students " << i + 1 << " -- id and number of students: ";
  44.       cin >> ids[i] >> totals[i];
  45.       grandTotal += totals[i];
  46. }
  47.       return grandTotal;
  48. }
  49.  
  50.       void printStudentID( int gTot, int n, int ids[], int totals[] )
  51. {
  52.       cout << endl
  53.       << setw(10) << "student ID"
  54.       << setw(12) << "Examination" << endl
  55.       << "----------------------" << endl;
  56.       for ( int i = 0; i < n; i++ )
  57. {  
  58.       cout << setw(10) << ids[i]
  59.       << setw(12) << totals[i] << endl;
  60. }  
  61.       cout << "----------------------" << endl
  62.       << setw(10) << "Total" << setw(12) << gTot    << endl;
  63. }
  64. }
  65. }
My questions is I think the programming is wrong But I dont know how to correct it...futher more how to include data file?
Jan 15 '08 #1
1 1950
weaknessforcats
9,208 Expert Mod 8TB
Yes, the programming is wrong because it won't compile.

Post again when it does compile.

Yor first error is that semi-colon at the end of line 17.
Jan 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
5
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more...
9
by: John | last post by:
I am using two large libraries which both have an implementation of a "matrix" class. I have the source code for both. I need to use them in the same project and when I try to compile I get a...
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
2
by: DarrenWeber | last post by:
Below is a module (matrix.py) with a class to implement some basic matrix operations on a 2D list. Some things puzzle me about the best way to do this (please don't refer to scipy, numpy and...
0
by: DarrenWeber | last post by:
# Copyright (C) 2007 Darren Lee Weber # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free...
14
lotus18
by: lotus18 | last post by:
Hello all I have these records on my Day Table for my complete database table please click here 1. M 2. T 3. W 4. TH 5. F 6. S
2
by: rijaalu | last post by:
I am designing a matrix class that performs addition, multicpication, substraction and division. When ever i complie the code it shows an error. include <iostream> using namespace std; class...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.