I am also like you , just learning C++ and I am impressed at your efforts, but I think one obvious lapse is that your division function didn't take care of divide by zero error which is quite common.
Take care
I am also like you , just learning C++ and I am impressed at your efforts, but I think one obvious lapse is that your division function didn't take care of divide by zero error which is quite common.
Take care
hmm this is interesting and educating..do you have any reference where I can learn more on using "Unions"
Thank you
hmm this is interesting and educating..do you have any reference where I can learn more on using "Unions"
Thank you
There is many errors in your PHP statement thats in the body of your page which I will explain below. Try somthing like this:
<?php for( $i = 0; $i < 4; $i++) { echo "<td align='center'><img src='" . $pictures[$i] . "' width='100' height='100' alt='" . $i . "'></td>"; } ?>
Your errors were here:
- Your if statment will only display 3 photos while there is 4 in your array. You can either change the number to test for to 4, or change your tester to less than or equal to .... <=.
- You commented out the part that places the picture filename into the image tag. (the // makes PHP ignore it.)
-You put the value of $i in the src part of your image tag.
- You did not close the third echo after the </td> tag
- Your PHP closing tag is backwards. Should be ?>
First I want to thank you for pointing out my errors, but I also have a question for you.
How do I see what errors I have with my PHP codes?(I mean is there like something similar to a debug window where errors and / or lines where they are will be displayed for my PHP codes)
Thanks
Hello all,
I'm a PHP newbie and have my apache Server and PHP in place. I have been able to run simple programs that work well. However, since then when I do "http ://localhost/filename.php" I either get 2 messages.
1. An error message if there's an error in my code
2. A blank page if I don't get an error message.
For example, the code below gives a blank screen. Pls help me with this.
<?php
$pictures = array('PixsIMG_0037.jpg','PixsIMG_0038.jpg','PixsIMG_0039.jpg
','PixsIMG_0040.jpg');
shuffle($pictures);
?>
<html>
<head>
<title>Doe Cafe</title>
</head>
<body>
<center>
<h1>Doe Cafe</h1>
<table width = '100%' >
<tr>
<?php
for( $i = 0; $i < 3; $i++)
{
echo '<td align="center"><img src =" ';
// echo $pictures[$i];
echo $i;
echo ' "width ="100" height ="100"></td>;
}
<?
</tr>
</table>
</center>
</body>
</html>
Hi,
you can do that functions in a single page itself
without doing two seprate pages.I have altered your code and i have given that below .you check that and if any doubt means ask upto my knowledge if know i will explainthe code
<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>HTML Form</title>
</head>
<?php
$name=$_REQUEST;
$comments=$_REQUEST;
$submit=$_REQUEST;
if($submit)
{
$ee="Thank you $name for the following comments :$commentsWe will reply to you at $email";
}
?>
<body>
<!--Script 2.1 -from.html -->
<form action="" method="post">
<fieldset><legend> Enter you information in the form below :</legend>
<p><? echo $ee;?> </p>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40" value="<?=$name?>"/></p>
<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>
<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name="comments" rows ="3" cols="50"><?=$comments?></textarea></p>
</fieldset>
<div align = "center"><input type ="submit" name="submit" value="submit"/><div>
</form>
Thanks for the help....but the problems still persists and I'd try to see if something else is wrong.
Hello All,
I am a PHP newbie and have all my resources set up( by that I mean PHP,Apache server etc all working fine)
I have an html file and a PHP script to handle the inputs from the html form. However when I hit submit to send the data to the PHP script I get a blank page.
Below are my files.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/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=iso-8859-1"/>
<title>HTML Form</title>
</head>
<body>
<!--Script 2.1 -from.html -->
<form action = "handle_form.php " method="post">
<fieldset><legend> Enter you information in the form below :</legend>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40"/></p>
<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>
<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name = "comments" rows ="3" cols="50"></textarea></p>
</fieldset>
<div align = "center"><input type = "submit" name ="submit" value ="Submit Information"/><div>
</form>
****...and here is the PHP script handling the form above*************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/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=iso-8859-1"/>
<title>Form Feedback</title>
</head>
<body>
<? php # Script …
Thanks Risby but do you know why I keep getting :
expr: syntax error
expr: syntax error
expr: syntax error
for each filename (argument)
Hello Everyone,
I need help on a part of the script below.The purpose is to accept some filenames as command line arguments and count the number of characters,words,lines in each file, and the total of each of these 3 attributes.
My output should look like this...
file 1 stats:
Number of characters: 100
Number of words : 50
Number of lines : 12
file 2 stats:
Number of characters: 200
Number of words : 65
Number of lines : 22
However my output presently looks like this:
$ ./test3 sush.pl sample
expr: syntax error
expr: syntax error
expr: syntax error
file 1 stats :
Number of characters : 75 sush.pl
Number of words : 12 sush.pl
Number of lines : 4 sush.pl
expr: syntax error
expr: syntax error
expr: syntax error
file 2 stats :
Number of characters : 102 sample
Number of words : 23 sample
Number of lines : 12 sample
I need help with taking out the expr: syntax error and the filename..like sush.pl,sample above that comes after each output
My code is as shown below
#!/bin/bash
index=0
sumChar=0
sumWords=0
sumLines=0
for file in $*; do
if [ -f "$file" ]; then
{
index=`expr $index + 1`
char=`wc -c $file`
words=`wc -w $file`
lines=`wc …
Hello everyone,
I have two classes Student and Courses. Class Students creates an object of class Courses since each Student will take some Courses.
How can I call an object of class Courses in class Students such that each Student class will have an instance of class Courses which will take care of setting , getting and printing course details for each students.
Also, how can I use inputs from console to initialize Students created. i.e., prompt user for input and use the set methods of the objects to take the console inputs to initialize the Student created.
Thank you in anticipation of your response.
Crestaldin
Hi everyone,
Can somene please explain to me how to run a telnet command using Java.I mean how can I achieve the following in Java : telnet mailServer PORT (where mailServer and PORT will be supplied)...and subequently capture response from the server.
Thanks .
Hi everyone,
I'd like to know if anyone can give me any idea(s) or resources to help me with a project I'm working on.
I am creating Email agents using SMTP and IMAP protocols.I have been able to work on the SMTP part, however, I'm having challenges writing the codes for retrieving email from IMAP server using Java.
Any suggestions, ideas or resources will be highly appreciated.
Thanks
Hi everyone,
Ps I'm new to Perl (but have been working on Unix for a while) and I'm trying to develop my skills by taking on a project . I am trying to create a perl script that when executed behaves like a Unix Shell, but I need help on how to capture user inputs and then run them as commands at the prompt.
For example , when the perl script is run and the user types ls ., I want to capture the ls, store it in a variable...say $input , and then run the ls command so that all files listed in the current working directory are listed.
Kindly explain how to go about this to me as this is the foundation of the larger picture that I have in mind.
Thanks in advance.
NB. If you know any online resource that will help in this work, kindly let me know.
Hi everyone,
I am new to XML in fact I am just about to really learn XML because I encoutered a lot of XML stuffs during my summer internship that ended a couple of weeks ago.
I am plannning to get a book titled "Beginning XML " by David Hunter , Andrew Watt et al , but I want to find out if this book is ideal for beginners or if anyone can recommend any other book that is suitable for beginners
Thanks in aniticpation of your response.
Yeah, we're not suppose to do your homework for you bud.
Do you have to use arrays? It might be best to use a HashMap here. Using a HashMap will allow you to count only the characters that you have and nothing else. However, you will have to make a lot of objects to make it work.
You also might want to look at the String methods .toUpperCase() and .toLowerCase().
Thank you for the suggestion but ... that's actually not my homework. I just went online (http://cs.furman.edu/ccscse2002/program_contest/problems/progcont_1995.pdf ) to get a website with Java problems and I'm working on them to improve on my skills.
I am trying to write a code to count the frequency of characters in a String;
For example if I have String str = new String("This is a test");
I want to count the number of occurrence of each character in the string.(assuming the code is case insensitive)
This is what I have at present ...
//
public static void main(String[] args)
{
// TODO Auto-generated method stub
String temp = new String("This is a test message");
//int[] alphabets = new int [26];
int [] temp1 = new int[100];
char [] s = temp.toUpperCase().toCharArray();
for(int i=0;i<s.length;i++)
{
temp1[(s-'A')]++;
}
for(int i =0;i<temp1.length;i++)
{
System.out.println(temp1);
}
}
}
}
I need help on how to complete this implementation.
Thanks in advance for your help.
Hello all,
I installed MySQL 5.O but due to some errors I need to uninstall the file , but while trying to delete the file, I keep getting a message that some files (under a specified directory) are shared by other processes or used by other users so I can't delete it.
How can I go about deleting this file.
Thanks in anticipation of your help.
Hi everyone,
I just finished my summer internship last week and part of what my boss told me at the end of the program was to impove my Java skills.
From experience I know the best way to master any programming skill(or the likes) is via practice so I am seeking help with possible online resources where I can get projects that will help me (from a beginner up the ladder), and also useful online tutorials / materials
Thanks.
Hi everyone,
I just finished my summer internship last week and part of what my boss told me at the end of the program was to work on DBMS skills. I am thinking of working on MySQL and from experience I know the best way to master any programming skill(or the likes) is via practice so I am seeking help with possible online resources where I can get projects that will help me (from a beginner up the ladder), and also useful online tutorials / materials
Thanks.
Thanks a lot iamthwee!
Hello,
I'm new to HTML parsing and I need some help.I want to parse a HTML file , and I have the Java classes in place but I need an advise on how to code a piece of logic in my callback function.
I need to parse through the file until I encounter the second table in the file and then display the contents of that particular table.
I'll be grateful if I can get help on this.
Thanks in advance..
Also I am getting a java.net.UnknownHostException: error when I enter any URL in my code. How can I solve that ?
Hello,
I am working on a project and at the moment I need to include a link to a web page in my JSP (portal).The link is essentially an HTML page but the issue is that I am required to only display a table from the target page on my portal .In essence I will have a link to that page but when the link is clicked, only a table on the target page will be displayed.
My question is how can I have only a table form the link displayed as opposed to the normal convention of having the whole page displayed.?
Thank you in advance.
Please I need help on how to insert elements into a sorted linked list.I actually have a list that contains names and scores for students and I want the elements to be inserted into the right postion such that the names of individual students are arranged alphabetically.
This is my code but something seems to be wrong.
#include "iostream"
using namespace std;
struct Node
{
char *name;
int score;
Node *next;
};
Node *head=NULL;
void InsertItem(Node * &head);
void main()
{
InsertItem(head);
}
void InsertItem(Node * &head)
{
Node *temp, *previous,*current; /*previous stores the node before the insertion point*/
temp=new Node();
cout<<"Enter name";
cin>>temp->name;
cout<<"Enter score";
cin>>temp->score;
if (head == NULL) /* first node in the list */
{
head = temp;
}
else if (strcmp(head->name,temp->name)>=0)/* insert at the head */
{
temp->next = head;
head = temp;
}
else
{
previous = head; /* trailing pointer */
current = head->next;
while ((current != NULL) && strcmp(current->name,temp->name)<0)
{
previous = current;
current = current->next;
}
temp->next=previous->next;
previous->next=temp;
}
}
Ps I need some help on how to install Fedora.
I just downloaded a copy of the OS on CD's and I am trying to install it on my desktop.However, the system does not boot from the CD.What do you think could be wrong.I used ISO burning software NERO..as required and I don't know what I did wrong.
Kindly help me out.
Thanks
Crestaldin.
Hello,
Ps can anyone enlighten me on how to learn PHP.
I mean I am a novice and would like to know if it requires a compiler etc like C++,C ..to compile codes.
In essence what are the things needed to learn PHP...and how can I really develop myself well in PHP.
..and any book reccomendation(s)
Thanks
Thanks ,I really appreciate yur response
:p Hello ,
Ps I need someone to direct me to any site where I can get some challenging programming tasks that will enable me develop my C++ programming skills.
I'm tired of reading books and tutorials and need to lay my hands on something practical this summer.
Thanks.
Can anybody help me with a code to clear the screen using C++.
I have a program that has to continuously make changes to an array and display the array after each modification.
All I need is a code to clear the screen after each display.
Thank you
Ps I need some help with my Windows programming assignment.
My instructor wants us to draw an ellipse(2D) and make it appear like a ball(3D) by applying different shades of the same color to different parts of the ellipse.
By assuming any point is the light source, parts near to that source will be lighter and parts farther will be darker but there should be a gradual change in the shades as one moves from one region to another.
He said we'd need a loop and (of course) a SetPixel function to do this.
Anyone who has an idea should please help out.