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... - //Algorithm to create a conflict graph//
-
#include <iostream>
-
#include <iomanip>
-
using std::cerr;
-
using std::cout;
-
using std::endl;
-
-
#include <fstream> // needed for files
-
using std::ifstream;
-
#include <cstdlib> // for exit function
-
-
using namespace std;
-
-
int main(void);
-
-
int readStudentID( int nStudents, int studentsids[], int ExamCode[] );
-
void printStudentID( int total, int nStudents, int studentids[], int ExamCode[] );
-
-
{
-
ifstream indata; // indata is like cin
-
int num; // variable for input value
-
inFile.open("St.Andrews83exm.txt", ios::in); // opens the file
-
if(!indata) { // file couldn't be opened
-
{
-
{
-
const int nStudents = 139 ; // Program inefficient if nCourses is large!
-
int studentids[ nStudents ], ExamCode[ nStudents ];
-
int total = readStudentID( nStudents, studentids, ExamCode );
-
-
printStudentID( total, nStudents, studentids, ExamCode );
-
return 0; // Error level of 0 means normal termination
-
}
-
-
int readStudentID( int n, int ids[], int totals[] )
-
{
-
int grandTotal = 0;
-
cout << endl
-
<< "For each of " << n << " students," << endl
-
<< " enter the Student ID and the Examination Code."
-
<< endl;
-
-
for ( int i = 0; i < n; i++ )
-
{
-
cout << "Students " << i + 1 << " -- id and number of students: ";
-
cin >> ids[i] >> totals[i];
-
grandTotal += totals[i];
-
}
-
return grandTotal;
-
}
-
-
void printStudentID( int gTot, int n, int ids[], int totals[] )
-
{
-
cout << endl
-
<< setw(10) << "student ID"
-
<< setw(12) << "Examination" << endl
-
<< "----------------------" << endl;
-
for ( int i = 0; i < n; i++ )
-
{
-
cout << setw(10) << ids[i]
-
<< setw(12) << totals[i] << endl;
-
}
-
cout << "----------------------" << endl
-
<< setw(10) << "Total" << setw(12) << gTot << endl;
-
}
-
}
-
}
My questions is I think the programming is wrong But I dont know how to correct it...futher more how to include data file?
1 1977
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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
|
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
|
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...
|
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
...
| |
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...
|
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...
|
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
|
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();
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |