This is on UNIX
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc,char **argv)
{
int pid,pid1,pid2,pid3;
Type: Posts; User: omGeeK
This is on UNIX
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc,char **argv)
{
int pid,pid1,pid2,pid3;
Alright so my code below works but it does not wait for a key to be pressed it just reads it once and then goes on its way. How would I go about waiting for a key pressed event to occur and then use...
Nevermind I FIGURED IT OUT!! I've have spent countless hours staring at the code. And I feel like an idiot that I didn't even try changing this the code for my copy constructor is
//copy...
Yes this a lab for school, and requires that we learn dynamic memory allocation with raw pointers. It sucks because my professor barely covered anything related to the topic so I have been learning...
I feel like the problem resides somewhere within my list (vector of matrices). Something about local heap errors occur when I use things from the list.
But what doesn't make sense to me is that...
I could care less this is for school about the security of it :). but for 2d then do a = [1 2 3 ; 1 2 3 ] the ; seperates rows
Alright well the code is pretty long so cheers lol. But the program will not run in release mode at all. But when I comment out the destructors code, it works fine in debug mode with no debugging.
...
The thing that is confusing me is that the right memory I want to delete is actually in the destructor. So I have no clue why delete[] won't work on it. Some more background info, is that I try...
clear
void Matrix::clear(void)
{
Matrix temp;
swap(temp);
}
Assignment operator
Alright so I have a class of Matrix which looks like
class Matrix
{
private:
string _name;
int errorInput;
int _row;
int _col;
double ** _mat;
Alright I'm back with some heap errors. I have debugged the crap out of it and I don't understand the problem. At random points when my destructor gets called I will get heap errors even though I...
Ugh alright thanks, guess Ill be hitting up Google all night..
Alright, Ill have to work on that but I have another quick question :biggrin:
//sets the data of a matrix given a matrix operator overloading
Matrix & Matrix::operator = (const Matrix &...
//transpose a matrix
Matrix Matrix::transpose(void)
{
int i,j;
if(this->_mat != NULL)
{
Matrix mtemp(*this);
this->clear();
_row = mtemp._col;
_col = mtemp._row;
#include "Matrix.h"
//default constructor
Matrix::Matrix()
{
_name = "Unknown";
_row = 0;
_col = 0;
_mat = NULL;
}
//copy constructor call
#include "Matrix.h"
//default constructor
Matrix::Matrix()
{
_name = "Unknown";
_row = 0;
_col = 0;
_mat = NULL;
}
//copy constructor call
True, but if you know you want to initialize to zero why not lol
int test[100] = {0}; Is a much simpler way of initializing an array to zero than calling a function like that as long as you want to initialize it to 0.
#include "Matrix.h"
//default constructor
Matrix::Matrix()
{
_name = "Unknown";
_row = 0;
_col = 0;
_mat = NULL;
}
//copy constructor call
Thanks fixed a bunch of stupid errors. I have been staring at this code for a while and clearly not really paying attention.
#pragma once
#include <vector>
#include <string>
#include <sstream>
#include <deque>
#include <iostream>
#include <iomanip>
using namespace std;
class Matrix
Vector for what?
Thanks for the heads up but what do you mean by a copy constructor? All i have is a default constructor
Unhandled exception at 0x01192af2 in ECE264 Lab 6.exe: 0xC0000005: Access violation reading location 0x00000000.
thats the error well the only thing i noticed is when i look at iT in debug mode...
// Finds matrix with name n in vector mL; returns -1 if matrix not present
int findMatrix(vector <Matrix> &mL, string n)
{
Matrix temp;
for(vector<Matrix>::iterator iT = mL.begin(); iT !=...