phorce 131 Posting Whiz in Training Featured Poster

I don't think you're understanding me.. I asked is there an error message showing, NOT what text editor you're using... Ok, try this:

<html>
<head>
</head>
<body>

<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");

mysql_select_db("ong_assesment",$connect);
$query = "SELECT Agent_ID,Address/Suburb,Bedrooms/Bathrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_erro());

if(!mysql_affected_rows() >= 1)
{
    echo 'There are no entries inside the database';
}
while($row = mysql_fetch_array($result))
{
    echo '<tr>';
    echo '<td>'. $row[Agent_ID].'</td>';
    echo '<td>'. $row[Address].'</td>';
    echo '<td>'. $row[Bedrooms].'</td>';
    echo '<td>'. $row[Price].'</td>';
}
    echo '</table>';

?>
</body>
</html>

Do you get the output: There are no entries inside the database? OR do you get something else?

phorce 131 Posting Whiz in Training Featured Poster

Is there an error showing? Is there anything in the table?

phorce 131 Posting Whiz in Training Featured Poster

Try this, bit different to your script.. Have a look at yours, you have many errors:

<html>
<head>
</head>
<body>

<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");

mysql_select_db("ong_assesment",$connect);
$query = "SELECT Agent_ID,Address/Suburb,Bedrooms/Bathrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result))
{
    echo '<tr>';
    echo '<td>'. $row[Agent_ID].'</td>';
    echo '<td>'. $row[Address].'</td>';
    echo '<td>'. $row[Bedrooms].'</td>';
    echo '<td>'. $row[Price].'</td>';
}
    echo '</table>';

?>
</body>
</html>

e.g. in yours you have:

mysql_select_db("ong_assesment',$connect);

should be:

mysql_select_db("ong_assesment",$connect);

Hope this helps

phorce 131 Posting Whiz in Training Featured Poster

Sorry for late reply.

This is working perfectly fine for me:

<?php

    $option = (bool) $_POST['option'];

    if(!isset($option))
    {
        echo 'You have not submitted an option';
    }

    switch($option)
    {
        case 1:
        // re-direct to link 1;
            $new_link = "index.php";

        break;

        case 2: 
        // re-direct to link 2:
            $new_link = "test.php";
            include($new_link);
        break;

        default:
            echo 'Invalid option';
        break;
    }


?>

Or alternatively, try this (all one file):

<?php

    if(!isset($_POST['submitted']))
    {
        // form hasn't been submitted
        echo '
        <form method="post">
        <input type="radio" name="option" value="TRUE">True</option>
        <input tpe="radio" name="option" value="FALSE">False</option>
        <input type="submit" name="submit" value="Go!">
        <input type="hidden" name="submitted" value="TRUE">
        ';

    }else{

      switch($option)
      {
            case 1:
                // re-direct to link 1;
                $new_link = "index.php";

            break;

            case 2: 
            // re-direct to link 2:
                $new_link = "test.php";
                include($new_link);
            break;

            default:
                echo 'Invalid option';
            break;
        }
    }


?>

I realised SESSIONS were a bad idea since we were recoding the data, so, it would always remember it!

phorce 131 Posting Whiz in Training Featured Poster

Also, why are these:

int one_1 = 1776;
int two_1 = 1999;
int three_1 = 2012;
int launch_1 = 138974;

not constants?

Also, if this is now solved, please mark as solved.

phorce 131 Posting Whiz in Training Featured Poster

I don't get what you mean. Ok, so, the form SHOULD display everytime the user visits this webpage? If that's the case, I don't know exactly why we're storing the value as a session. Could you give me an example of how you want the form, maybe I could create it for you? Just a suggestion. Write our your specifications etc..

phorce 131 Posting Whiz in Training Featured Poster

P.S. There are a lot of variables.. Like:

int one;
    int two;
    int three;
    int launch;
    int one_1 = 1776;
    int two_1 = 1999;
    int three_1 = 2012;
    int launch_1 = 138974;

Couldn't these be in some kind of an array?

phorce 131 Posting Whiz in Training Featured Poster

I don't get what you mean by 'resets' itself. Do you want it to remember what the option was so when the user re-visits the page, it will remember what the option was? If so, do this:

<?php
    ob_start();
    session_start();

    if(!isset($_SESSION['option']))
    {
        $a = (bool) $_POST['option'];
    }else{
        $a = $_SESSION['option'];
    }

    if($a)
    {
        $a = "index.php";
        // redirect OR include $a
        $_SESSION['option'] = true;
    }else{
      include ('test.php');
      $_SESSION['option'] = false;
    }


?>
phorce 131 Posting Whiz in Training Featured Poster

I don't get what you mean..

You can't set $a = index.php and expect true or false, only if it's a weird function and it's returning either true/false.. So I think you mean:

<?php

  $a = (bool) $_POST['option']; // this will either store true/false
  if($a)
  {
     $a = "index.php";
     // redirect OR include $a
  }else{
    include ('test.php');
  }
?>
phorce 131 Posting Whiz in Training Featured Poster

@Javvy good idea! Or you could have an hidden attribute inside your form:

<input type="hidden" name="submitted" value="TRUE">

Making sure it's after your submit button and then inside PHP:

<?php
  if(isset($_POST['submitted']))
  {
      // SQL
      // SQL
  }
phorce 131 Posting Whiz in Training Featured Poster

Ok - Can you tell us what else needs to be done? I'm confused!

phorce 131 Posting Whiz in Training Featured Poster

Hey @coolikedat99 - Without getting negative feedback. I would look at using a more OO (Object-Oriented) approach, for me, there's quite a lot of code in main, probably more than there needs to be. Also, your use if IF statements could be replaced with SWITCH statements if and when needed.

phorce 131 Posting Whiz in Training Featured Poster

@diafol

I'm with you, however, I do think PHP does have a function here.. If anything, it could be used for displaying the appropriate cam, for example.. www.site.com/viewcam.php?id={id}.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm not an expert in this field, but, I'm sure you can stream the security camera to a web-server. I don't really /think/ this can be done in PHP and therefore PHP only handles which camera is shown, for example switch between HOUSE 1 and HOUSE 2 and also who can access this particular camera.

Showing the cameras might have to be done using Flash OR jQuery plug-in.

This is just my suggestion, I am not an expert in this field.

karthik_ppts commented: Thanks for your valuable time +7
phorce 131 Posting Whiz in Training Featured Poster

Just a quick question.. (I'm very tired so might be missing the point)!

But if I had this code:

<?php 
global $json_news;
var_dump($json_news);
echo"<br/>=======================<hr/>";
?>

It would return NULL because although you are defining $json_news as a global, you're not setting it as anything.. Surely, your function whats to return the array and then you assign the output of the function to this global variable? In other words, your function "show_news()" might return something..

Kinda like this:

<?php 

function show_news(){
     $json_news = array(
                "id" => 0,
                "title" => ""
            );

    return $json_news;
}

global $json_news;

$json_news = show_news();
var_dump($json_news);

?>

// output
// output
array(2) {
  ["id"]=>
  int(0)
  ["title"]=>
  string(0) ""
}

I'm very tired though, might be missing the point!

phorce 131 Posting Whiz in Training Featured Poster

Is this solved now?

phorce 131 Posting Whiz in Training Featured Poster

try:

  <form method="post" action="test2.php">
    <input type="radio" name="option" value="TRUE">True</option>
    <input tpe="radio" name="option" value="FALSE">False</option>
    <input type="submit" name="submit" value="Go!">
phorce 131 Posting Whiz in Training Featured Poster

Harsh negative feedback, if I'm honest. People learn differently.

WaltP commented: And have you proven he learns better by being given the answer? +0
phorce 131 Posting Whiz in Training Featured Poster

and whats wrong with line 25??

I think @Ancient means it should be int main() rather than void main()

phorce 131 Posting Whiz in Training Featured Poster

Hey, try this:

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    int one;
    int ran_num;

    time_t seconds;
    time (&seconds) ;
    srand((unsigned int) seconds);
    ran_num = rand();
    cout << ran_num << endl;

    cout<<"Enter this number: ";
    cin>> one;
    if (one == ran_num) {
    cout<<"\nSparta\n";
    }else{
        cout << "Not the right number:(!";
    }
}

Store the random number inside a variable, then you can compare it!

WaltP commented: Don't just fix code for someone. *Help* them fix the code themselves -3
phorce 131 Posting Whiz in Training Featured Poster

What is the error?

phorce 131 Posting Whiz in Training Featured Poster

Hey, I think I get what you mean:

Let's say your radio button had the name of "option" and a value of either true/false

<?php

  $a = $_POST['option']; // this will either store true/false
  if($a)
  {
     echo 'a is true';
     //print ("A is true");
  }else{
    include ('test.php');
  }
?>

Hopefully this makes sense :)

Also, a note to when using the operator ">" this implies you mean more-than, but, boolean cannot be more than true.. It can simply be true or false (1 or 0).

phorce 131 Posting Whiz in Training Featured Poster

Aha, please forgive me.. If everything is working fine when you access XICS.php then the problem isn't there ;) post process_login.php! Apologies :)

phorce 131 Posting Whiz in Training Featured Poster

Do you mean inheritence?

Inheriting methods from one class to another.

phorce 131 Posting Whiz in Training Featured Poster

Please re-post XICS.php again, with the fixes, exactly how it is with the error :)

phorce 131 Posting Whiz in Training Featured Poster

Are you re-delcaring the function and including "functions.php"?

Please post the script in which you get this problem on.. I don't see the problem in the script you've just posted above..

phorce 131 Posting Whiz in Training Featured Poster

Pardon?

Ok, to me you have included the "functions.php" file and initalised the sessions in the wrong place.. It needs to be delcared at the top of the script, before anything else.. So, the code I posted, should now work?

vishalonne commented: 3 +2
phorce 131 Posting Whiz in Training Featured Poster
<?php
include "functions.php";
sec_session_start();
?>

<!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>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>cbse cs n ip - Anything regarding CBSE XI and XII Computer Subjects</title>
        <meta name="description" content="Latest IP NOTES,SAMPLE PAPERS,PRACTICAL & Project FILE OF IP" />
        <meta name="keywords" content="cbse cs and ip,11 cbse,11 cbse sample papers," />

        <link href="css/other.css" rel="stylesheet" type="text/css" />  
        <link href="css/other2.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" type="text/css" href="csshorizontalmenu.css" />
        <script type="text/javascript" src="csshorizontalmenu.js"></script>
        <script type="text/javascript">
            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-34001071-1']);
            _gaq.push(['_trackPageview']);
            (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();
        </script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
     /*$(document).ready(function() {
      $('#ul1 li a').click(function(e) {
       e.preventDefault();
       $('#content').load($(this).attr('href'));
      });
     });*/
     $(function(){
        $('#ul1 li a').on('click', function(e){
            e.preventDefault();
            var page_url=$(this).prop('href');
            $('#content').load(page_url);
        });
    });
    </script>
    <body>
        <div id="main_container">
            <div id="container">
                <div id="banner_container">
                    <div id="login_container">
                        <span class="style1" >Email or Phonee</span>                                    <span class="style1" >Password</span>  <br />                    <input type="text" id="Text1" class="box" />                    <input type="password" id="Password1" class="box" />                    <input id="Submit1" type="submit" value="Log In" /><br />                    <span class="style1" >Forgot your password?</span>                </div>
                <div class="horizontalcssmenu">                <ul id="cssmenu1">                    <li style="border-left: 1px solid #202020;"><a href="http://www.cbsecsnip.in">Home</a></li>                    <li><a href="#">Computer Science</a>                        
    <ul>                            
    <li><a href="http://www.cbsecsnip.in/csnip/XICS.php">XI</a></li>                            
    <li><a href="http://www.cbsecsnip.in/csnip/XIICS.php">XII</a></li>                        
    </ul>                    
    </li>                    
    <li><a href="#">Informatics Practices</a>                        
    <ul>                            
    <li><a href="http://www.cbsecsnip.in/csnip/XIIP.php">XI</a></li>                            
    <li><a href="http://www.cbsecsnip.in/csnip/XIIIP.php">XII</a></li>                        
    </ul>                    
    </li>                    
    <li><a href="http://www.cbsecsnip.in">Take Test</a></li>                    
    <li><a href="http://www.cbsecsnip.in">Software</a></li>                    
    <li><a href="http://www.cbsecsnip.in">Register</a></li>                    
    <li><a href="http://www.cbsecsnip.in">Get Together</a></li>
                    </ul> …
phorce 131 Posting Whiz in Training Featured Poster

@vishalonne

In that file, are you including/requring where the function is? For example, you use the function in XICS.php but I can't see where you include "functions.php". Is the function inside dbconnect.php OR a reference to the function?

phorce 131 Posting Whiz in Training Featured Poster

On the first line of XICS.php you have this line:

<?php
  $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
  sec_session_start(); 
 ?>

Well, you're defining the constant "HOST", "USER", "PASSWORD", "DATABASE" in the file, process_login.php - So it looks, from looking at the code it doesn't know where it is.. So in that case, you need to include CICS.php in the process_login.php..

Alternatively, why not have just a file that connects to the database itself, and, everytime you want to connect to the database, just include/require this file?

You could have a file that JUST has the DATABASE CONNECTION details in and then require it.. Either way, you need a way of making sure the server knows where HOST and other credentials is.

phorce 131 Posting Whiz in Training Featured Poster

So, how, I am reading it from memory?

Thank's for your reply

phorce 131 Posting Whiz in Training Featured Poster

Hello, having a weird problem and wondering if someone can help me.. Basically, I'm trying to read in a .wav file, and I have read in the header information and that's all fine, it's just the data..

Here is the code:

bool Wav::readHeader(ifstream &file)
{

    file.read(this->chunkId,                                 4);
    file.read(reinterpret_cast<char*>(&this->chunkSize),     4);
    file.read(this->format,                                  4);

    file.read(this->formatId,                                4);
    file.read(reinterpret_cast<char*>(&this->formatSize),    4);
    file.read(reinterpret_cast<char*>(&this->format2),       2);
    file.read(reinterpret_cast<char*>(&this->numChannels),   2);
    file.read(reinterpret_cast<char*>(&this->sampleRate),    4);
    file.read(reinterpret_cast<char*>(&this->byteRate),      4);
    file.read(reinterpret_cast<char*>(&this->align),         2);
    file.read(reinterpret_cast<char*>(&this->bitsPerSample), 4);

    char testing[4] = {0};
    int testingSize = 0;

    while(file.read(testing, 4) && (testing[0] != 'd' ||
                                    testing[1] != 'a' ||
                                    testing[2] != 't' ||
                                    testing[3] != 'a'))
    {

    file.read(reinterpret_cast<char*>(&testingSize), 4);
    file.seekg(testingSize, std::ios_base::cur);

   }

   this->dataId[0] = testing[0];
   this->dataId[1] = testing[1];
   this->dataId[2] = testing[2];
   this->dataId[3] = testing[3];
   file.read(reinterpret_cast<char*>(&this->dataSize),     4);

   this->data = new char[this->dataSize];

   file.read(data,                     this->dataSize);

   unsigned int *te;

   te = reinterpret_cast<int*>(&this->data);

   cout << te[3];

   return true;
 }

Now if I use the readwav in Matlab I get the result (of the third element, same file): -0.0078 But in the C++ output I get 1031127695

I have heard it's something to do with the fact I'm outputting it as an integer, but I've tried every data type there is.

Any ideas? Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Yes, vector elements can be printed the same way as arrays, just like in your example.. (Why haven't you compiled some code to test?!?).

void Player::addISpace (int i)
{
    for (;i > 0; i--)
    {
        pSInv.push-back(0);
    }
}

I don't get this code.. Let's say that pSInv was a vector of type int, then you would push_back i rather than 0.

Hope this helps :)

phorce 131 Posting Whiz in Training Featured Poster

What does the tree look like?

phorce 131 Posting Whiz in Training Featured Poster

Shouldn't ask for homework..

using System;

namespace ddggd
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            char[] characters = new char[8];

            for (int i=0; (i < 8); i++) {
                Console.WriteLine ("Please enter character: " + i);
                characters [i] = Convert.ToChar (Console.ReadLine ());
            }

            for (int j=0; (j < 8); j++) {
                Console.WriteLine (characters [j]);
            }
        }
    }
}

Something like this?

phorce 131 Posting Whiz in Training Featured Poster

Ok, hello!

Right, first off, you haven't actually said what you want to do in speech recognition, as it is a massive area. So to answer your question:

is this project to large to be done by 4 month? is it that hard to get along with androids frameworks etc.

Yes, it is. First of all you need to atleast have an understanding of signal processing, and frequencies, which, requires you to use such things as FFT's / Zero-Crossing and other features. You need to stop looking at Libraries - The whole idea is understanding Speech Recognition and the process behind it. Not just saying "I'll google a library and read their documentation".

For my final year project, I am detecting whether someone is saying either "Yes" or "No" and believe it, it is very difficult.

So, in your question, please be more specific so people can help you more :)!

phorce 131 Posting Whiz in Training Featured Poster

Hello, Vectors are arrays, but, arrays are defined in size (memory allocations) whereas Vectors are dynamically assigned, in memory. So for example, if you reach the maximum capacity in an array it will run out of memory whereas vectors will just change it's size dynamically and therefore allocate more memory.

How you assign them, I don't really get what you mean but here's an example:

#include <iostream>
#include <vector>

using namespace std;
int main(int argc, char *argv[]) {

    vector<int> numbers; // Declare vector without a size.

    vector<string> names(2); // Define a vector with a size of 2 elements

    names.push_back("Phorce");
    names.push_back("Bob");
    names.push_back("Jimmy");
    /*
        Note how I have 3 elements, in an array, it would force a memory error
        if not handled.
    */

    for(unsigned i=0; (i < names.size()); i++)
    {
        cout << names[i] << endl;

    }

}

In terms of classes, ok:

#include <iostream>
#include <vector>

using namespace std;

class Foo
{

    public:
        // add elements to the vector
        void addNames(string theName)
        {
            this->names.push_back(theName);
        }

        // retrive the vector
        vector<string> getNames()
        {
            return this->names;

        }
    private:

    vector<string> names;
};

int main(int argc, char *argv[]) {

    Foo foo;

    foo.addNames("Phorce");
    foo.addNames("Jimmy");

    vector<string> theNames = foo.getNames();

    for(unsigned i=0; (i < theNames.size()); i++)
    {
        cout << theNames[i] << endl;

    }

}

Basic example, probably going to get bad rep but that's how I see vectors (In a simple way). Hope this helps you a bit :)!

P.S. Can you post examples of how you're trying to implement the vectors? It might help …

phorce 131 Posting Whiz in Training Featured Poster

No problem :)

If this has been solved, please mark it so and give repo to those who helped you..

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Look at this example:

#include <iostream>
#include <string>
using namespace std;

string* returnString(const char* filename) {
 string* names = new string[3];
 names[0] = "Hello";
 names[1] = "World";
 names[2] = "huuhaa"; 

 return names;
}
int main(int argc, char *argv[]) {

    string* names = returnString("file.txt");

    for(unsigned i=0; (i < 3); i++)
    {
        cout << names[i] << endl;

    }
}

Or use a vector :) You've included it! Hope this helps though

phorce 131 Posting Whiz in Training Featured Poster

or more advanced one:

http://www.amazon.co.uk/PHP-MySQL-Dynamic-Web-Sites/dp/032152599X/ref=sr_1_1?ie=UTF8&qid=1345629611&sr=8-1

I learnt from Larry Ullman, good recommendation :) - He's a bit ignorant, but, his books are good!

phorce 131 Posting Whiz in Training Featured Poster

If the file is massive, why not load it inside memory in chucks, then find the patterns?

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Wasn't negative feedback, more, positive!

Ok, so let's say we have 2 news articles:

'Apple iPad Mini is under development'

'Lost returns with a new series'

Then you can have comments, depending on the article. For example, people can post/see coments on the iPad mini and others can post/view comments on Lost. Clear it up? I'm sure you've seen it on news websites :)

phorce 131 Posting Whiz in Training Featured Poster

Aha Hello there,

I like it, well done for your first project :)! You should look into jQuery/AJAX and see if there are ways in which these languages can help improve it / Make it more "elegant".

Your next move to develop it further would look at how to have comments specifically on an ID. Take a new system, for example. You could have a way that comments are shown depending on which new article the user clicks on.

Just a thought :) Good Luck!

phorce 131 Posting Whiz in Training Featured Poster

Search on Google.

How much programming (PHP) and logic do you know? If there are no tutorials online specially aimed at creating a support-ticket application then think about what is involved in creating one, then, research and look at tutorials for specific individual things that will help you :)

phorce 131 Posting Whiz in Training Featured Poster

Yeah, try Google.

Why re-invent the wheel? Just get a pre-made one!

phorce 131 Posting Whiz in Training Featured Poster

a clients home and enter in the dementions, add walls where needed and add the products we offer. I see other websites that offer this option with their products. Any advice, thoughts, suggestions would be helpful.

Hey, it depends how advanced you want the system, this will determine which language to use.

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Please indent your code properly.. Ok, so the only error(s) I could find was that you have a function called "deposit" and a variable with the same name.

This code is compiling for me:

#ifndef MENU_BUILDER_H
#define MENU_BUILDER_H
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>

using namespace std;

//Define my class
class MenuBuilder
{
double amount;
private:
string accountNumber;
string firstName;
string middleName;
string lastName;
double withdrwal;
double deposit;
double balance;

public:
MenuBuilder();
MenuBuilder(string accountNumber, string firstName, string middleName, string lastName, 
double withdrwal, double deposit);
void checkBalance();
void withdrawal();
void tdeposit();
void viewAccount();
void viewStatement();
void viewBankInformation();
~MenuBuilder(void);
};
MenuBuilder::MenuBuilder(void)
{
amount=2439.45;
}


MenuBuilder::~MenuBuilder(void)
{
}

void MenuBuilder::checkBalance()
{
cout<<endl<<"Current balance is: $"<<amount;
}
void MenuBuilder::withdrawal()
{
double amt;
cout<<endl<<"How much would you like to withdraw? $ ";
cin>>amt;
amount=amount-amt;
}
void MenuBuilder::tdeposit()
{
double amt;
cout<<endl<<"How much would you like to deposit? $ ";
cin>>amt;
amount=amount+amt;
}
void MenuBuilder::viewAccount()
{
cout<<endl<<"Name: (Phil Sutton)";
cout<<endl<<"Account Number: XXXXXXXXXX ";
}
void MenuBuilder::viewStatement()
{
cout<<endl<<"01/01/11 - McDonalds - $6.27";
cout<<endl<<"01/15/11 - Kwik Trip - $34.93";
cout<<endl<<"02/28/11 - Target - $124.21";
}
void MenuBuilder::viewBankInformation()
{
cout<<endl<<"Devry Bank, established 2011";
cout<<endl<<"(XXX) XXX-XXXX";
cout<<endl<<"12345 1st St.";
cout<<endl<<"Someplace, NJ 12345";
}
int main()
{
char choice;
MenuBuilder atm;
cout<<endl<<"Welcome to the Devry Bank Automated Teller Machine";
do
{
cout<<endl<<endl<<"1. Check balance";
cout<<endl<<"2. Make withdrawal";
cout<<endl<<"3. Make deposit";
cout<<endl<<"4. View account information";
cout<<endl<<"5. View statement";
cout<<endl<<"6. View bank information";
cout<<endl<<"7. Exit";
cout<<endl<<"Enter your choice: ";
cin>>choice;
switch (choice)
{
case '1':
atm.checkBalance();
break;
case '2':
atm.withdrawal();
break;
case …
phorce 131 Posting Whiz in Training Featured Poster

Hey, thanks for your reply..

Basically, I am trying to convert this code (matlab):

function f = strip(blocks, sumthresh, zerocrossthresh)

% This function removes leading and trailing blocks that do 
% not contain sufficient energy or frequency to warrent consideration.
% Total energy is measured by summing the entire vector.
% Frequency is measured by counting the number of times 0 is crossed.
% The parameters sumthresh and zerocrossthrech are the thresholds,
% averaged across each sample, above which consideration is warrented.

% A good sumthresh would be 0.035
% A good zerocrossthresh would be 0.060

len = length(blocks);
n = sum(size(blocks)) - len;
min = n+1;
max = 0;
sumthreshtotal = len * sumthresh;
zerocrossthreshtotal = len * zerocrossthresh;
for i = 1:n
  currsum = sum(abs(blocks(i,1:len)));
  currzerocross = zerocross(blocks(i,1:len));
  if or((currsum > sumthreshtotal),(currzerocross > zerocrossthreshtotal))
    if i < min
      min = i;
    end
    if i > max;
      max = i;
    end
  end
end

% Uncomment these lines to see the min and max selected
% max
% min

if max > min
  f = blocks(min:max,1:len);
else
  f = zeros(0,0);
end

But for some reason, I don't know why they are using this:

n = sum(size(blocks)) - len;

Because, surely, I can just interate through the 2D vector, and then check to see if the blocks contain the criteral for energy/frequency..

Any ideas? :)

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm just wondering whether or not, it is possible to get the vector Dimensions without them being set?

Basically, I'm converting some matlab code and there's a function size(VECTOR) which get's the dimentions of the vector being passed.

For example:

#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {

    vector<vector<int> > items;

    vector<int> theItems(20);

    for(unsigned i=0; (i < 20); i++)
    {
        theItems.push_back(i);
        items.push_back(theItems);
    }
}

I need to determine the dimensions of items. Can I use something like capacity? Or is there a STL function like in matlab where you have size.

phorce 131 Posting Whiz in Training Featured Poster

If this thread is solved, please mark it as solve. And give respect to those who you think helped you.

Good luck :))!