473,473 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

error C2601: 'det' : local function definitions are illegal

5 New Member
#include <iostream>
using namespace std;

int x[4][4],detA,detB,detC,detD,detM;


void main()

{

//input function for 4x4 matrix

for ( int i =0; i < 4 ; i++)

for ( int j =0; j < 4 ; j++)
{
cout << " input x[" << i <<"]["<<j<<"]";
cin >> x[i][j];
}



//output function for 4x4 matrix

{
for( i =0; i < 4 ; i++)
{
cout <<"\n";
}

for( int j =0; j < 4 ; j++)
{
cout<< x[i][j];
cout<<"\t";
}
}

//determinant of 4x4 matrix
void det ()
{
detA = (x[1][1])( -1^2)((x[2][2])(x[3][3])(x[4][4]) + (x[2][3])(x[3][4])(x[4][2])+(x[2][4])(x[3][2])(x[4][3])-
(x[4][2])(x[3][3])(x[2][4])-(x[4][3])(x[3][4])(x[2][2])-(x[4][4])(x[3][2])(x[2][3]));

detB = (x[2][1])(-1^3) ((x[1][2])(x[3][3])(x[4][4])+ (x[1][3])(x[3][4])(x[4][2])+ (x[1][4])(x[3][2])(x[4][3])-
(x[4][2])(x[3][3])(x[1][4])-(x[4][3])(x[3][4])(x[1][2])-(x[4][4])(x[3][2])(x[1][3]));

detC = (x[3][1])(-1^4) ((x[1][2])(x[2][3])(x[4][4])+ (x[1][3])(x[2][4])(x[4][2])+ (x[1][4])(x[2][2])(x[4][3])-
(x[4][2])(x[2][3])(x[1][4])-(x[4][3])(x[2][4])(x[1][2])-(x[4][4])(x[2][2])(x[1][3]));

detD = (x[4][1])(-1^5) ((x[1][2])(x[2][3])(x[3][4])+ (x[1][3])(x[2][4])(x[3][2])+ (x[1][4])(x[2][2])(x[3][3])-
(x[3][2])(x[2][3])(x[1][4])-(x[3][3])(x[2][4])(x[1][2])-(x[3][4])(x[2][2])(x[1][3]));

detM = detA + detB + detC + detD;
}

}
Jan 22 '12 #1
7 5488
Rabbit
12,516 Recognized Expert Moderator MVP
You tried to declare det() inside main(), you can't do that.
Jan 23 '12 #2
paulo bagon
5 New Member
can you revised my program and make it right???please badly needed T_T
Jan 23 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Move the declaration outside of the main function.
Jan 23 '12 #4
paulo bagon
5 New Member
how can u do it for me.??please??
Jan 23 '12 #5
paulo bagon
5 New Member
wen i put it outside theres another error "error C2064: term does not evaluate to a function"
Jan 23 '12 #6
paulo bagon
5 New Member
#include <iostream>
using namespace std;

int x[4][4],detA,detB,detC,detD,detM;


void main()
{


//input function for 4x4 matrix

{
for ( int i =0; i < 4 ; i++)

for ( int j =0; j < 4 ; j++)
{
cout << " input x[" << i <<"]["<<j<<"]";
cin >> x[i][j];
}

}

//output function for 4x4 matrix

{
for( int i =0; i < 4 ; i++)
{
cout <<"\n";
}

for( int j =0; j < 4 ; j++)
{
cout<< x[i][j];
cout<<"\t";
}
}

}

//determinant of 4x4 matrix
void det ()
{

detA = (x[1][1])( -1^2)((x[2][2])(x[3][3])(x[4][4]) + (x[2][3])(x[3][4])(x[4][2])+(x[2][4])(x[3][2])(x[4][3])-
(x[4][2])(x[3][3])(x[2][4])-(x[4][3])(x[3][4])(x[2][2])-(x[4][4])(x[3][2])(x[2][3]));

detB = (x[2][1])(-1^3) ((x[1][2])(x[3][3])(x[4][4])+ (x[1][3])(x[3][4])(x[4][2])+ (x[1][4])(x[3][2])(x[4][3])-
(x[4][2])(x[3][3])(x[1][4])-(x[4][3])(x[3][4])(x[1][2])-(x[4][4])(x[3][2])(x[1][3]));

detC = (x[3][1])(-1^4) ((x[1][2])(x[2][3])(x[4][4])+ (x[1][3])(x[2][4])(x[4][2])+ (x[1][4])(x[2][2])(x[4][3])-
(x[4][2])(x[2][3])(x[1][4])-(x[4][3])(x[2][4])(x[1][2])-(x[4][4])(x[2][2])(x[1][3]));

detD = (x[4][1])(-1^5) ((x[1][2])(x[2][3])(x[3][4])+ (x[1][3])(x[2][4])(x[3][2])+ (x[1][4])(x[2][2])(x[3][3])-
(x[3][2])(x[2][3])(x[1][4])-(x[3][3])(x[2][4])(x[1][2])-(x[3][4])(x[2][2])(x[1][3]));

detM = detA + detB + detC + detD;
}
Jan 23 '12 #7
Rabbit
12,516 Recognized Expert Moderator MVP
That error is because you're trying to do what I assume is multiplication without the multiplication operator, *

Also, please use code tags when posting code.
Jan 23 '12 #8

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

Similar topics

14
by: Joerg Schuster | last post by:
Hello, according to http://mail.python.org/pipermail/tutor/2001-July/007246.html the order of function definitions does matter in python. Does anyone know a trick to avoid this? Is there a...
9
by: Dario | last post by:
This is a technical C++ post regarding the Microsoft runtime error R6025 Pure Virtual Function Call that sometime occurs in programs compiled with Microsoft Visual C++ 6.0. Please consider the...
5
by: Kobu | last post by:
Does anyone know how old style function definitions differ in "behaviour" to new style function definitions? I heard the old style function definitions caused integeral promotion and floating...
8
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
15
by: unknownbomb | last post by:
Hey all i really hope you can help me out. Im compiling a project and im getting 2 errors which are saying local function definitions are illegal. Anyone know what this mean? And especially...
1
by: kaygee | last post by:
Hi ppl can anyone tell me what this error means? error C2601: 'meanData' : local function definitions are illegal
8
by: borophyll | last post by:
I don't understand the difference between these two declarations int foo(char a, char b) { ... } int foo(a, b) char a, b; {
3
by: MrHenry007 | last post by:
Hello! I'm fairly new to c++ but I have been following tutorials and have created functions before, but not one using a string. I can't work out what the problem is here. The function is supposed...
5
by: kirayamato1992 | last post by:
i wrote some codes for my assignments. then it came out several problems involving illegal local function definition. #include <iostream> using namespace std; void system_module(); void...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
1
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...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.