rahul8590 71 Posting Whiz

well firstly sorry for late reply, i still didnt get few things.

"The first step is to identify the issue. "

well since i am naive in this field , all i can get from the error messgae is that i am not able to send messages, according to all the post put up it comes to the conclusion that Wamp server had no SMTP

1. Is there ne way in which i can config or add ne module in WAMP so that the SMTP is incorporated into it.

Take the $headers out of the mail function and test the script again.
Does it work?
If so, your headers need to be correct.

These headers will work for plain text, no attachement. Don't forget to set $fromaddress to the proper address.
Help with Code Tags
php Syntax (Toggle Plain Text)


$headers = "MIME-Version: 1.0\r\n";

$headers .= "Content-type: text/plain; charset=iso-8859-1\r \n";

$headers .= "From: \"$fromaddress\" <$fromaddress>\r \n";

$headers .= "Reply-To: \"$fromaddress\" <$fromaddress>\r \n";

$headers .= "Date: " . date("r") . "\r\n";

honestly So9NE , i have no idea what ur talking about , i would be glad if u could be a little more explicit.

One option would be to use a tool like phpmailer, to send your emails through your gmail/hotmail/provider account.

i would appreciate if u could enlighten me abt phpmailer.
As a matter of fact is there any other modules (or what ever its called) like these, which …

rahul8590 71 Posting Whiz

i have created a simple form (well with the help of a book ).
i am able to process the data and display it . But i amnot able to send the same message to my mail ID.
i am using WAMP server. i am running the script from my system .

The normal form code (report.html)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Aliens Abducted Me - Report an Abduction</title>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
  <h2>Aliens Abducted Me - Report an Abduction</h2>

  <p>Share your story of alien abduction:</p>

  <form method="post" action="report.php">

    <label for="firstname">First name:</label>
    <input type="text" id="firstname" name="firstname" /><br />
    
    <label for="lastname">Last name:</label>
    <input type="text" id="lastname" name="lastname" /><br />
    
    <label for="email">What is your email address?</label>
    <input type="text" id="email" name="email" /><br />

    
    <label for="whenithappened">When did it happen?</label>
    <input type="text" id="whenithappened" name="whenithappened" /><br />
    
    <label for="howlong">How long were you gone?</label>
    <input type="text" id="howlong" name="howlong" /><br />
    
    <label for="howmany">How many did you see?</label>
    <input type="text" id="howmany" name="howmany" /><br />
    
    <label for="aliendescription">Describe them:</label>

    <input type="text" id="aliendescription" name="aliendescription" size="32" /><br />
    
    <label for="whattheydid">What did they do to you?</label>
    <input type="text" id="whattheydid" name="whattheydid" size="32" /><br />
    
    <label for="fangspotted">Have you seen my dog Fang?</label>
    Yes <input id="fangspotted" name="fangspotted" type="radio" value="yes" />
    No <input id="fangspotted" name="fangspotted" type="radio" value="no" /><br />
    
     <img src="fang.jpg" width="100" height="175"
      alt="My abducted dog Fang." /><br />

    <label for="other">Anything else you want to add?</label>
    <textarea id="other" name="other"></textarea><br />
    
    <input type="submit" value="Report Abduction" name="submit" /> …
rahul8590 71 Posting Whiz

kudos to peter_budo , yeah now i get this stuff ...
its printing the text i enter.

Is there any web server which is generic and runs all the web technologies like PHP and JSP n all .

rahul8590 71 Posting Whiz

May be your right. but is there any way i can perform this simple task of just printing the text.

rahul8590 71 Posting Whiz

i have created 2 files
1.chat.html

<HTML>
    <HEAD>
        <TITLE>Enter your name</TITLE>
    </HEAD>

    <BODY>
        <H1>Enter your name</H1>
        <FORM NAME="form1" ACTION="chat123.jsp" METHOD="POST">
            <INPUT TYPE="TEXT" NAME="text">
            <INPUT TYPE="SUBMIT" VALUE="Submit">
        </FORM>
    </BODY>
</HTML>

2.chat123.jsp

<HTML>
    <HEAD>
        <TITLE>
            Using Java in JSP
        </TITLE>
    </HEAD>

    <BODY>
        <H1>Using Java in JSP</H1>
            Your Name is
        
          <% out.println(request.getParameter ("text")); %>
    </BODY>
</HTML>

When i click on the submit button , the text in the text box is supposed to be printed but its not.

Besides this code works properly only in IE , when i run it in Firefox , instead of executing the chat123.jsp file , all the source code is displayed.

I ran all the code in Wampserver .
i have no idea where i went wrong , i would be glad if you guys can help me out.

rahul8590 71 Posting Whiz

nope it didnt work , i removed the single quote near senders...

rahul8590 71 Posting Whiz

well i did remove the double quotes and tries but still it aint printing nething.
the following is the php code

<?
  if(($_post[sender_name] == "") ||
     ($_post[sender_email]== "") ||
     ($_post[message] == "")) 
   {
      header("Location: simple_form.html");
      exit;
    }
$msg = EMail sent from WWW site \n;
$msg .= senders Name:\t $_post['sender_name']\n;
$msg .= Sender's E-Mail:\t$_POST['sender_email']\n;
$msg .= Message:\t$_POST['message']\n;
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@yourdomain.com>\n";
$mailheaders .= Reply-To: $_POST['sender_email']\n;
mail($to, $subject, $msg, $mailheaders);

?>


<HTML>
<HEAD>
<TITLE>Simple Feedback Form Sent</TITLE>
</HEAD>
<BODY>

<H1>The following e-mail has been sent:</H1>

<P><strong>Your Name:</strong><br>
<? echo $_POST['sender_name']; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo $_POST['sender_email']; ?>
<P><strong>Message:</strong><br>
<? echo $_POST['message']; ?>

</BODY>
</HTML>
rahul8590 71 Posting Whiz

yep i had downloaded the wingware IDE and it wasnt a free software, apart from wing IDE , do u suggest ne thing else i guess netbeans should do good.

rahul8590 71 Posting Whiz

i designed a simple php form which accepts the data and then displays it, (well its supposed to ) but its kinda not displaying the values it should..

<html>
<head>
<title> Simple feedback form </title>
</head>
<body>

<form method = "post" action="send_simpleform.php">
<p><strong>Your name: </strong><br>
<input type = "text" Name="sender_name" size = 30> </p>

<p><strong>Email - ID: </strong><br>
<input type = "text" Name="sender_mail" size = 30> </p>

<p><strong>Message: </strong><br>
<textarea name = "message" cols=30 rows=5 wrap=virtual></textarea> </p>

<p><input type = "submit" name = submit" value="send this form"> </p>
</form>
</body>
</html>

The above is the normal html form and below i have included the php code

<?
  if(($_post[sender_name] == "") ||
     ($_post[sender_email]== "") ||
     ($_post[message] == "")) 
   {
      header("Location: simple_form.html");
      exit;
    }
$msg = "EMail sent from WWW site \n";
$msg .= "senders Name:\t $_post[sender_name]\n";
$msg .= "Sender's E-Mail:\t$_POST[sender_email]\n";
$msg .= "Message:\t$_POST[message]\n";
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@yourdomain.com>\n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n";
mail($to, $subject, $msg, $mailheaders);

?>


<HTML>
<HEAD>
<TITLE>Simple Feedback Form Sent</TITLE>
</HEAD>
<BODY>

<H1>The following e-mail has been sent:</H1>

<P><strong>Your Name:</strong><br>
<? echo "$_POST[sender_name]"; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo "$_POST[sender_email]"; ?>

<P><strong>Message:</strong><br>
<? echo "$_POST[message]"; ?>

</BODY>
</HTML>

i have no idea why isnt the values being displayed...

rahul8590 71 Posting Whiz

well any other ingenious method.. since i am new to python and i just installed it . is there any other way can i solve the issue may be some other toolkit or stuff , i guess it would be better if everything comes in a pack.
is there ne ide which provided everything in a pack.

rahul8590 71 Posting Whiz

i have recently installed wxpython on python2.5 and wrote the following code

import wx
app = wx.App()
app.MainLoop()

Then i got this error(attached file) , and i have no idea what it talks about.
Traceback <most recent call last):
File "<stdin>", line 1 , in <module>
File "C:\Python25\Lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py",line 493

in_init_
newobj = _windows_.new_Frame(*args , **kwargs)

wx._core.PyNoAppError : the wx.App object msut be vreated first!


i have no idea on wat to do..

rahul8590 71 Posting Whiz

well i can access like that... it completly runs as
http://localhost/myfile.php not a problem. but i guess my scripts have problem..

and debugger for this php scripts available........

rahul8590 71 Posting Whiz

i did that .. but i am still getting "Message Failed To send "
is there any other way to do it or so...

rahul8590 71 Posting Whiz

well i have (not precisely) created a form which accepts manily

1.name
2.subject
3.Message

well i have written the php code for that ,well the data sent by the user is supposed to come to my mail id since i am getting the message fail error i have , i guess i have written something wrong so , i dunno where i went wrong

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
	"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" 
   content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
   if ($_SERVER['REQUEST_METHOD'] != 'POST'){
      $me = $_SERVER['PHP_SELF'];
?>
   <form name="form1" method="post"
         action="<?php echo $me;?>">
      <table border="0" cellspacing="0" cellpadding="2">
         <tr>
            <td>Name:</td>
            <td><input type="text" name="Name"></td>
         </tr>
         <tr>
            <td>Subject</td>
            <td><input type="text" name="Subject"></td>
         </tr>
         <tr>
            <td valign="top">Message:</td>
            <td><textarea name="MsgBody"></textarea></td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit"
               value="Send"></td>
         </tr>
      </table>
   </form>
<?php
   } else {
      error_reporting(0);
      $recipient = 'rahul8590@yahoo.com';
      $subject = stripslashes($_POST['Subject']);
      $from = stripslashes($_POST['Name']);
      $msg = "Message from: $from\n\n".stripslashes($_POST['MsgBody']);
      if (mail($recipient, $subject, $msg))
         echo nl2br("<b>Message Sent:</b>
         To: $recipient
         Subject: $subject
         Message:
         $msg");
      else
         echo "Message failed to send";
}
?>
</body>
</html>

i would be glad if u could improvise it.

rahul8590 71 Posting Whiz

well as of now i have installed wamp. in my system . so how do i run these php scripts into it.

rahul8590 71 Posting Whiz

You may run PHP scripts as console applications, which is much simpler then installing full blown server on your computer. Download and unpack php somewhere, find php.exe and run it with your file.php as parameter, from command line (cmd).
C:\PHP\php.exe -f file.php

well kudos to you.. it ran and i got the output . (obviously i just printed statemet)
now if i want to create a proper file .. then how do i do that , i mean accept the data from the file i have built.

rahul8590 71 Posting Whiz

well here is the code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>
Seminar Form
</title>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- CSS -->
<link rel="stylesheet" href="css/structure.css" type="text/css" />
<link rel="stylesheet" href="css/form.css" type="text/css" />

<!-- JavaScript -->
<script type="text/javascript" src="scripts/wufoo.js"></script>
</head>

<body id="public">
	
<img id="top" src="images/top.png" alt="" />
<div id="container">

<h1 id="logo"><a>Wufoo</a></h1>

<form id="form71" name="form71" class="wufoo topLabel" autocomplete="off"
	enctype="multipart/form-data" method="post" action="#public">

<div class="info">
	<h2>Seminar Form</h2>
	<div>Please fill in the details for registration</div>
</div>

<ul>
		
	
<li id="foli0" 		class="   ">
	<label class="desc" id="title0" for="Field0">
		Name
			</label>
	<span>
		<input id="Field0" 			name="Field0" 			type="text" 			class="field text" 			value="" 			size="8" 			tabindex="1" 			/>
		<label for="Field0">First</label>
	</span>
	<span>
		<input id="Field1" 			name="Field1" 			type="text" 			class="field text" 			value="" 			size="14" 			tabindex="2" 			/>
		<label for="Field1">Last</label>
	</span>
	</li>


<li id="foli2" 		class="   ">
	<label class="desc" id="title2" for="Field2">
		Position
			</label>
	<div>
		<input id="Field2" 			name="Field2" 			type="text" 			class="field text medium" 			value="" 			maxlength="255" 			tabindex="3" 						/>
			</div>
	</li>


<li id="foli3" 		class="   ">
	<label class="desc" id="title3" for="Field3">
		Home Institution
			</label>
	<div>
		<input id="Field3" 			name="Field3" 			type="text" 			class="field text medium" 			value="" 			maxlength="255" 			tabindex="4" 						/>
			</div>
	</li>


<li id="foli4" 		class="   ">
	<label class="desc" id="title4" for="Field4">
		Email
			</label>
	<div>
		<input id="Field4" 			name="Field4" 			type="text" 			class="field text medium" 			value="" 			maxlength="255" 			tabindex="5" 			/> 
	</div>
	</li>


<li id="foli5" 		class="   ">
	<label class="desc" id="title5" for="Field5">
		Phone
			</label>
	<span>
		<input id="Field5" 			name="Field5" 			type="text" 			class="field text" 			value="" 			size="3" 			maxlength="3" 			tabindex="6" 			/> - 
		<label for="Field5">(###)</label>
	</span>
	<span>
		<input id="Field5-1" 			name="Field5-1" 			type="text" 			class="field text" 			value="" 			size="8" 			maxlength="8" 			tabindex="7" 			/> - 
		<label for="Field5-1">###</label>
	</span>
	
	</li>


<li id="foli10" 		class="   ">
	<label class="desc" id="title10" for="Field10"> …
rahul8590 71 Posting Whiz

well i am supposed to write this in the script file of the form which i got ..? if yes then where am i supposed to write ( i guess it follows some structure or pattern of witting ) .

rahul8590 71 Posting Whiz

well i have been doing quite lot a research on web stuff (still naive)
i have got various templates for my site and then finally a seminar form which i have downloaded from http://www.wufoo.com
now i want to accept the data entered from the form and store it in my database. i have no idea on how to proceed on that.
i would be glad if you guys can help me out.

rahul8590 71 Posting Whiz

well at first place ... thanks to all of you guys taking such an initiative to help me .
kudos to almostbob to come with such an explanation . well as of now i am kinda getting the picture.
well i have modified the templates and linked the pages to one another.
well i have a html form which has to accept the seminar details. i have downloaded the form from http://www.wufoo.com

and i will link it to the main page .. then how do i accept the data entered from that form (well i guess here the php comes into picture and mysql to store the data in ts database ) and store it in the database , well sorry to bother you .. but is there any site or resource that can teach me didactically .

rahul8590 71 Posting Whiz

so apart from a , i guess a cheesy graphic display which again i guess will be mostly a resolution problem , rest all things works fine..?
like installing packages and other stuffs.......

rahul8590 71 Posting Whiz

Note that in the current edition of mandriva ( Spring 2009 ) there are serious display problems related with Intel Drivers. So if you are using any Intel Graphics Card then I would advise you to not use the latest Mandriva.

well i thought it was very much compared to windows xp and peroformed well in some cases better the windows 7.
well what kind of display problems are you talking about...?
will that also effect on other widgets or applications inside it...?

rahul8590 71 Posting Whiz

Well yeah now i am getting a hang on it.. well if i have to change it looks then i gotto change those pics in image folder then ( i guess) .
well thats for the front part .. well then where does PHP and MYSQL come into picture .

rahul8590 71 Posting Whiz

Well when ur project compilation is in process (thats assuming in cd ) does it by any chance create and database or file to store data or any kind of modification or edition happens in that case. well u gotto take care about that . cuz once written in CD (which happens to read only) u cannot forcibly (well u can but will be superfluous) push in file or modify the existing one.

rahul8590 71 Posting Whiz

Well of course i will not install mandriva on c drive (where windows is installed ) . Even if i back up the data in fedora and save it in some other drive for that matter.
Can i directly install mandriva on that fedora space to overwrite it or
will i have to boot xp2 cd to make that particular partition NTFS and then finally install windows on it.

rahul8590 71 Posting Whiz

Serellyn well thanks for the nudge...
now taking it a step further. how do i link those contact and other buttons in it to other pages that i will have to create. and besides is it imperative to know html in depth or a mediocre knowledge is sufficient.

rahul8590 71 Posting Whiz

recently i have been brosing thru many web templates and have downloaded some of the,.. well now i want to modify the text and put my text in those .. well i aint have any idea on how to do that..?
well if text manipulations are possibly (which i think it is ) then hpw do i program it that on clicking this button it must go to the next page or load another page ....?
i would be glad if you guys could help me out ...

rahul8590 71 Posting Whiz

well recently i got the mandriva spring summer 2009 edition and i saw the snapshots.. its just awesome :cool: , well and i want to install it on my system.

since i already have fedora 8 and windows xp2 partitioned on my disk and for some reason i dont want to use fedora any more so how should i proceed the installation in such a manner that i install it over fedora but , my data in fedora is should be intact . besides will by any chance will i loose my windows in this process ..?
i would be glad if you guys could help me in this.

rahul8590 71 Posting Whiz

well in that case pal , could u enlighten ur more about the kind of enviornment ur working in and wat is your project all about ..?

rahul8590 71 Posting Whiz

well this is how i have come so far.....

well the following data are static and cannot be changed + predefined

1.no of classes
2.each classes capacity
3.no of branches
4.semseter subjects


the following is the data which will be accepted

1.capacity of students in particular branch
2.the period on which the exam wil be organised

now i thinking that...
firstly i will accept the subjects and the capacity of students attempting for it
secondly
the dates on which those subjects will be coducted.

well i have got this far only..... i would be glad if you could help me further.

rahul8590 71 Posting Whiz

dude i think you havent undestood me .......
i just need some simple fuction which will plot the graph for me when i inout the co ordinates, thats all . there is no complication in it.

i got a link and copied those libraries , but its giving me an error.

the underneath is the link from where i copied libraries
http://codecutter.org/tools/koolplot/

the error i got is something like this

graph.cpp||undefined reference to `Plotdata::Plotdata(double, double)'|
graph.cpp||undefined reference to `plot(Plotdata const&, Plotdata const&)'|
graph.cpp||undefined reference to `COLOR'|
graph.cpp||undefined reference to `COLOR'|
graph.cpp||undefined reference to `COLOR'|
graph.cpp||undefined reference to `COLOR'|
graph.cpp||undefined reference to `COLOR'|
graph.cpp||more undefined references to `COLOR' follow|
||=== Build finished: 8 errors, 0 warnings ===|
Salem commented: Thanks for the link, could be useful for others wanting to convert 'up' to the modern world. +30
rahul8590 71 Posting Whiz

well i just need a function which can plot a graph in x/y axis thats it.

rahul8590 71 Posting Whiz

well i am willing to install any libraries.. n working on minGW compiler.
n working on windows , its kinda not possible to change the platform .. but in the worst case that can be considered.....

rahul8590 71 Posting Whiz

i am working on my project which is on regeression of lines .
well i have been successful in fitting a straight line to the given set of coordinates . since i have come so far after a lot of striving , i have been a bit exhausted on writing a graphic function of plotting the co - ordinates and displaying a graph.

Well is there any function or header file which will directly plot a graph if i provide a given set of co - ordinates.

rahul8590 71 Posting Whiz

i guess u didnt understand my code..... why dont you execute this code and see how exactly it works.......
and variable can also be put inside instead of boolean, any way 1= TRUE and and 0 or lesser implies false.......

and if you have observed the original code.. it doesnt have ne room for allowing the user to exit..
if he./she presses the wrong number , its just wants to accept the new number .. so where the h@#l the user will exit............

rahul8590 71 Posting Whiz

flag is a variable name .. u can also write ur name instead of that.. its just that i am a bit convenient with that name that's its.....
and i am also giving an option in switch case if the user wants to exit.
both the way it works.....

rahul8590 71 Posting Whiz

actually u can use a flag......(its just a variable but commonly know as flag when used in such purposes )

void display( )
{  
	int option, int flag =1;
	system("cls"); //clear screen
	cout<<endl<<endl;
	cout<<"\t  * Display Menu *\n";
	cout<<"\n\t1. Display For Certein Date"<<endl; 
	cout<<"\t2. Display All Appointments"<<endl;
	cout<<"\t3.  exit"<<endl;
	cout<<"\nEnter Option Number: ";  //Enter option
	cin>>option;
	cin.get();
    while(flag)
	{   
        switch ( option ) 
        {
            case 1: displayCerteinDate ( );
                    break;
            case 2: displayAll ( );
		             break;
            case 3: flag =0;
                     break;
            default: cout<<endl<<"Wrong option number!! Try again\n";
                    cin.get();         //give the user a chance to read the output data
	  }
	}

}

i have intialised a variable flag to 1 . and put the whole swicth inside a while loop which check for the status of the flag.
i have included an exit option in the menu . so as soon as the user presses 3. the flag =0 and the while condition fails , eventually u will come out of the loop and program ends

tux4life commented: That's not real programming +0
rahul8590 71 Posting Whiz

k srry didnt see that ......... well dont worry u get the kudos for that.....
:P

rahul8590 71 Posting Whiz

well i think this should solve your problem.... very well

http://www.cplusplus.com/reference/string/string/find/
:)

rahul8590 71 Posting Whiz

well firstly i apologize that , i didnt quite read ur problem well , since the title spoke for itself.

well i have an easier way to do it .
u get the string thats the text in an array (t in alog) and the patter u wanna match in another array ( p in algo) .
the alog will work something like this

N O B O D Y - N O T I C E D - H I M 
N O T              
  N O T
      N O T 
         N O T
            N O T 
               N  O T
                    N O T

WELL AT THIS POINT THE SUBSTRING IS EQUAL TO STRING AND U GET WAT U ASKED FOR.

rahul8590 71 Posting Whiz

well here is the algorithm ....

algorithm stringmatch( t[0-n-1] , p[0- m-1])

t = array of text 
p = array of pattern u wanna match
{
       for i ->0 to n-m do ,
             j->0
            while j<m and p[j] = t[i+j]
                    j <- j+1
                   if j = m  return i
      return -1
}

it will return the position from where the string matches the pattern.

rahul8590 71 Posting Whiz

ok it may take a little while... but i am working on it.

rahul8590 71 Posting Whiz

well at first place sorry for late reply............

well the major issue is should i organize it keeping majorly students or the class room and the center .
besides how to put students who have failed in particuar subject and re- writing the exam....

rahul8590 71 Posting Whiz

hi everyone , i am trying to access image files in java and then want to modify those bits present in the image . is there any standard package or utility which would help me to do that ...?

i would be glad if you could enlighten me with other methods ..

rahul8590 71 Posting Whiz

i think there is more to observe than to explain in here . i guess it would be prudent if you could run the underneath code and observe the output , it would be crystal clear .
The code does the same job :

#include<iostream>
using namespace std;

int main ()
{
    int sum=0, a=0, b=0;
for (a=1;a<3;a++)
{
    cout<<"start of b loop"<<endl;
        for (b=1;b<5;b++)
    {

    cout<<sum<<"+"<<b<<"=";
    sum+=b;
    cout<<sum<<endl;
    }
    cout<<"end of b loop "<<endl;
}
cout <<"the final sum is =" <<sum;
return 0;
}
rahul8590 71 Posting Whiz

well i have compiled it and its giving me the output.....

seriously this compiler issue is freaking me out .its not the first time such a thing is happened in this forum

i work on code blocks and i think its mingw compiler.

rahul8590 71 Posting Whiz

well at first place ur problem is not a 2d matrix .infact its multi dimensional ..

the following algo might help u a bit.

1. u will have to accept the rows and coloumns and dynamicallyy create an array.for both of yours a n b matrix.

2. as you will have to overlap a over b.
check whether the all matrix positions in a are in b . if they arent make an account of it and dont execute the underneath step.

3. then over write the contents of b from a thats it.

rahul8590 71 Posting Whiz

ohh sorry for that ....
i will post the corrected one.......

well i just compiled this and it worked...

#include<iostream>
using namespace std;

struct student
{
    char name[10];
    int m1,m2,m3;
    float avg;

    void findavg()
    {
        avg = (m1+m2+m3)/3;
    }

    void disp ()
    {
        cout<<name;
        cout<<m1<<m2<<m3<<endl;
    }

    void accpt()
    {
        cin>>name>>m1>>m2>>m3;
    }
};

int main()
{
    int x ;
    cout<<"enter how many records";
    cin>>x;
    student std[x];
    for(int i=0;i<x;i++)
    std[i].accpt();
    for(int i=0;i<x;i++)
    std[i].disp();

return 0;
}
rahul8590 71 Posting Whiz

well i had a similar assignment in my college .i cannot give you the complete program but the underneath can give u the nudge your looking for.

#include<iostream>
using namespace std;

struct student
{
    char name[10];
    int m1,m2,m3;
    float avg;

    void findavg()
    {
        avg = (m1+m2+m3)/3;
    }

    void disp ()
    {
        cout<<name<<"\t";
        cout<<m1<<m2<<m3<<endl;
    }

    void accpt()
    {
        cin>>name>>m1>>m2>>m3;
    }
};

int main()
{
    int x;
    cout<<" enter how many records ?";
    cin>>x;
    student std[x];
    // i guess from here you can write an iterative loop to accept and display the data
    // although u will have to write a sorting funnction (outside the structure )to sort the name and print accordingly .

return 0;
}
rahul8590 71 Posting Whiz

well at the first place i dont undstand why u need pointers for doing this , apart from the string (which u need pointer )

well as far as i have guessed u need to print the length of an array.

void length(char *st1[],int *i)
{
* i=strlen(*st1);
cout<<endl<<"length of string st1 is ="<<*i;
}

1. strings are passed by reference , its default so no need of explicitly writing the * in front of it

2. in strlen function u have used * ..? its wrong

3.while calling the function in main program u have written

length (&str , &i)

string is string (char array) , the variable hold the base address of the array itself.so u need to pass just str thats it.

i have remodified ur code n it workd now

#include<iostream>

using namespace std;



void length(char st1[],int *i1)
{
 *i1=strlen(st1);
cout<<endl<<"length of string st1 is ="<<*i1;
}
int main()
{ int i;
char st1[15];//,st2[15],st3[15],st4[15];
cout<<"Enter 1 strings :";
gets( st1);
cout<<"string is :"<<st1;
length(st1,&i); //gives only one error in this line
return 0;
}