Go to Post Active control of game pieces throughout all stages of your robot's interactions with it is critical. Never let gravity/inertia control the game piece. If you want a game piece to go somewhere, you MAKE it go there. - Jeremy Germita [more]
Home
Go Back   Chief Delphi > Other > FIRST-related Organizations > The Blue Alliance
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 12-07-2011, 06:32
walkershane123 walkershane123 is offline
Junior Member
FRC #1111
 
Join Date: Jul 2011
Location: usa
Posts: 1
walkershane123 is an unknown quantity at this point
Re: [TBA]: Example Code Addition

just check out this one. i found new examples



Code:
Matrics Addition

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

struct matrics
{
int a[4][4], m, n;
};

matrics add_mat(matrics m1, matrics m2);		//prototype declared

int main()
{
matrics x1, x2, x3;
int i, j;
cout<<"
Enter the size of matrics
";
cout<<"
Enter rows 
";
cin>>x1.m;
cout<<"
Enter columns 
";
cin>>x1.n;
cout<<"
Enter the elements (Row-wise & Column-wise)
	for(i=0; i<x1.m; i++)
	{
		for(j=0; j<x1.n; j++)
		cin>>x1.a[i][j];
	}
cout<<"
Enter the size of 2nd matrics
";
cout<<"
Enter rows
";
cin>>x2.m;
cout<<"
Enter columns
";
cin>>x2.n;
cout<<"
Enter the elements (Row-wise & column-wise)
	for(i=0; i<x2.m; i++)
	{
		for(j=0; j<x2.n; j++)
		cin>>x2.a[i][j];
	}
x3=add_mat(x1,x2);
cout<<"
The added matrics is
";
	for(i=0; i<x3.m; i++)
	{
		for(j=0; j<x3.n; j++)
		cout<<x3.a[i][j]<<" ";
	}

matrics add_mat(matrics m1, matrics m2)
{
matrics m3;		//object of matrics type
int k, l;
if((m1.m==m2.m) && (m1.n==m2.n))
	{  m3.m=m1.m+m2.m;
	   m3.n=m1.n+m2.n;
	}

	for(k=0; k<m1.m; k++)
	{
		for(l=0; l<m1.n; l++)
		m3.a[k][l]=m1.a[k][l]+m2.a[k][l];
	return (m3);
	}
}//		end of If loop

else
cout<<"
Addition is not possible
";
}

i need your feedback plz
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Example code TEAM1949 Programming 10 15-03-2006 16:00
Updated: Example Gyro Interface Code Kevin Watson Programming 2 28-03-2005 04:36
Example gyro code released. Kevin Watson Programming 60 17-03-2005 18:32
Example accelerometer code released. Kevin Watson Programming 0 20-01-2005 03:45
Autonomous Code Example Matthew_H Robotics Education and Curriculum 24 21-11-2003 10:02


All times are GMT -5. The time now is 02:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi