473,804 Members | 3,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conflict matrix

nurulshidanoni
40 New Member
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 1977
weaknessforcats
9,208 Recognized Expert Moderator Expert
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
3337
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 my particular application. One of the advantages is that the _compiler_ can force inner matrix dimensions used in multiplication to agree. A _complie-time_ error will be triggered if you write A * B and the number of coluns in A does not equal the...
5
3808
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 complex operator, I get stuck. Here's a brief description what I want to do. I want to simulate a matrix (2D array) from a 1D array. so what I have so far is something like this: class Matrix
9
2330
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 double declaration conflict. I tried to wrap the smaller library into a namespace but its a nightmare. Is there anyway I could solve this problem without giving up on one of the libraries? Thanks, --j
20
5251
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 used various techniques ( loop unrolling, loop jamming...) and tried some matrix libraries : newmat (slow for large matrix) , STL (fast but ..not usefull) , hand coding (brain consuming...), and recently Meschach...
1
7979
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 compiled and run without any erros but the second program has a run time error when the function return from allocate and the ptr become NULL. How to fixed this? Second Program: /* Best Method to allocate memory for 2D Array because it's ...
2
8567
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 numeric because this is a personal programming exercise for me in creating an operational class in pure python for some *basic* matrix operations). 1. Please take a look at the __init__ function and comment on the initialization of the list data...
0
2818
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 Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY...
14
6910
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
2667
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 matrix{ public: matrix();
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.