AndrisP 193 Posting Pro in Training
#include <iostream>
#include <iomanip>

int main()
    {
    srand(time(NULL));
    const int a=5;
    const int b=5;
    int arr[a][b];
    for(int i=0; i<a; i++){
        for(int j=0; j<b; j++){
            arr[i][j] = rand()%9+1;
            std::cout << std::setw(4) << arr[i][j];
            }
        std::cout << "\n";
        }
    std::cout << "\n";

    std::cout << "corner: " << arr[0][0] << " " << arr[a-1][0] << " " << arr[0][b-1] << " " << arr[a-1][b-1] << "\n\n";
    std::cout << "cornerSum=" << ( arr[0][0] + arr[0][b-1] + arr[a-1][0] + arr[a-1][b-1] ) << "\n\n";

    system("PAUSE");
    return 0;
    }
AndrisP 193 Posting Pro in Training

join lines 18 and 19 in your code please

AndrisP 193 Posting Pro in Training

What is the question?

AndrisP 193 Posting Pro in Training

still false

AndrisP 193 Posting Pro in Training
var x = prompt('enter your name');
    alert('hello '+ x);
AndrisP 193 Posting Pro in Training

I try this:

var q = "3";
var re = new RegExp("/^(\-)?\d+( (\-)?\d+){" + q + "}$");
alert(re.test("1 2 3 4"));

but return false

AndrisP 193 Posting Pro in Training

How I can passing quantifier as variable in this regexp str.match(/^(\-)?\d+( (\-)?\d+){3}$/)

AndrisP 193 Posting Pro in Training

in line 11 <input type="submit" onClick="runMe"> change to <input type="submit" onclick="runMe()" />

AndrisP 193 Posting Pro in Training
<input type="submit" name="submit" value="submit" onclick="this.disabled=true" />
AndrisP 193 Posting Pro in Training

Something like this:

#include<iostream>

using namespace std;
const int cnt=5;


int main ()
{
int k[cnt];
int sum=0;
for(int i=0; i<cnt; i++)
    {
    cin >> k[i];
    sum+=k[i];
    }
cout << "sum: " << sum << endl;
system ("PAUSE");
return 0;
}
AndrisP 193 Posting Pro in Training

I checked again, but PHP generated dates are not always on Sunday - so wrong!
This works in C++ and it seems that the correct:

#include <sstream>
#include <iostream>


using namespace std;

string ZeroPadNumber(int num){
    stringstream ss;
    // the number is converted to string with the help of stringstream
    ss << num; 
    string ret;
    ss >> ret;
    // Append zero chars
    int str_length = ret.length();
    for (int i = 0; i < 2 - str_length; i++)
        ret = "0" + ret;
    return ret;
    }

void EasterDate(int X){                             // X = year to compute
    int K, M, S, A, D, R, OG, SZ, OE;

    K  = X / 100;                                   // Secular number
    M  = 15 + (3 * K + 3) / 4 - (8 * K + 13) / 25;  // Secular Moon shift
    S  = 2 - (3 * K + 3) / 4;                       // Secular sun shift
    A  = X % 19;                                    // Moon parameter
    D  = (19 * A + M) % 30;                         // Seed for 1st full Moon in spring
    R  = D / 29 + (D / 28 - D / 29) * (A / 11);     // Calendarian correction quantity
    OG = 21 + D - R;                                // Easter limit
    SZ = 7 - (X + X / 4 + S) % 7;                   // 1st sunday in March
    OE = 7 - (OG - SZ) % 7;                         // Distance Easter sunday from Easter limit in days

    //Easter = DateSerial(X, 3, OG + OE);           // Result: Easter sunday as number of days in March
    cout << X << "-" << ZeroPadNumber(((OG + OE)>31)?4:3) << "-" << ZeroPadNumber((((OG + OE)%31)==0)?31:((OG + OE)%31));
    }

int main ()
{
    int year;
    do {
        cout << "Put the year: ";
        cin >> year;
        EasterDate(year);
        cout << endl << endl;
        }
    while (year>0);
    return 0;
}
AndrisP 193 Posting Pro in Training

ddanbe, I compared to a built-in PHP function "easter_date()" and adjust alghoritm to C++

#include <iostream>
using namespace std;

void EasterDate(int Year)
    {
        // Gauss Calculation
        ////////////////////

        int Month = 3;

        // Determine the Golden number:
        int G = Year % 19 + 1;

        // Determine the century number:
        int C = Year / 100 + 1;

        // Correct for the years who are not leap years:
        int X = ( 3 * C ) / 4 - 12;

        // Mooncorrection:
        int Y = ( 8 * C + 5 ) / 25 - 5;

        // Find sunday:
        int Z = ( 5 * Year ) / 4 - X - 10;

        // Determine epact(age of moon on 1 januari of that year(follows a cycle of 19 years):
        int E = ( 11 * G + 20 + Y - X ) % 30;
        if (E == 24) {E++;}
        if ((E == 25) && (G > 11)) {E++;}

        // Get the full moon:
        int N = 44 - E;
        if (N < 21) {N = N + 30;}

        // Up to sunday:
        int P = ( N + 7 ) - ( ( Z + N ) % 7 );

        // Easterdate: 
        if ( P > 31 )
        {
            P = P - 31;
            Month = 4;
        }
        cout << Year << "." << Month << "." << P;
    }

int main ()
{
    int year;

    for(int i=1970; i<2038; i++){
        EasterDate(i);
        cout << endl;
        }
    return 0;
}
AndrisP 193 Posting Pro in Training

I solved your project syntax, but alghoritm not correct

// EasterProject
#include<iostream>
    using namespace std;
int main()
{ 
    int intyear, intEasterDate, intEasterMonth;
    int a, b, c, d, e, f, g, h, i, j, k, m, p;
do {
cout<< "What's the year? \n";
    cin>> intyear;

cout<<"Easter Month is \n";

if (intyear<0001||intyear>5000)
    { cout<<"This calculator cannot serve you\n";
    return -1; }
a=intyear%19;
b=intyear/100;
c=intyear%100;
d=b/4;
e=b%4;
f=(b+8)/25;
g=(b-f+1)/3;
h=((19*a)+b-d-g+15)%30;
i=c/4;
j=c%4;
k=(32+(2*e)+(2*i)-h-j)%7;
m=(a+(11*h)+(22*k))/451;
intEasterMonth=(h+k-(7*m)+114)/31;
p=(h+k-(7*m)+114)%31;
intEasterDate=p+1;
cout << intEasterMonth << "." << intEasterDate << "\n\n";
} while (intyear>=0001&&intyear<=5000);

return 0;
}
AndrisP 193 Posting Pro in Training

if($rows==1) is not good "1" can be understood as TRUE considered as 1 or 2 or 3 or etc

AndrisP 193 Posting Pro in Training

Your sql query $log=mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' "); ignored upper/lower letters and considers "e"=="é" etc, i recommended this: $log=mysql_query("SELECT * FROM users WHERE username LIKE BINARY '$username' AND password LIKE BINARY '$password' ");

AndrisP 193 Posting Pro in Training
AndrisP 193 Posting Pro in Training

in line 9 print entry as link, like: "<a href="".$entry."">".$entry."</a>"

AndrisP 193 Posting Pro in Training
function my_opendir($dir) {
  if ($handle = opendir($dir)) {
    echo "<ul>Directory handle: $dir<br />Entries:";

    while (false !== ($entry = readdir($handle))) {
      if($entry=="."||$entry=="..") { continue; }
      echo "<li>";
      if(is_dir($dir.$entry)) { my_opendir($dir.$entry); }
      else { echo $entry; }
      echo "</li>";
      }
    echo "</ul>";

    closedir($handle);
    }
  }
AndrisP 193 Posting Pro in Training

Yes it's true. Sorry

AndrisP 193 Posting Pro in Training

Very easy in MySQL query:
$sql = "SELECT DATEDIFF('2012-08-02','".date('Y-m-d')."')";

AndrisP 193 Posting Pro in Training
$incr = 0;
function my_increment()
    {
    global $incr;
    $my_string = "Bla-bla-bla";
    $my_increment = str_pad($incr, 4, "0", STR_PAD_LEFT); // how many digits you need (eg.4)
    $incr++ ;
    return $my_string.$my_increment;
    }
AndrisP 193 Posting Pro in Training

if(!authorized) - wrong

if(!$authorized) - correct

AndrisP 193 Posting Pro in Training

shortly:
<td>First Party*:</td><td><input type="text" name="firstparty" value="<?=(isset($firstparty)&&!is_null($firstparty))?$firstparty:"";?>"/></td>

AndrisP 193 Posting Pro in Training

Maybe try this (line 26):
echo isset($email[$j])?$email[$j]:"";

AndrisP 193 Posting Pro in Training

It can be written concisely

#include <iostream>
using namespace std;

class Calculator {
public:
    void add(int i, int a);
    void subtract(int i, int a);
    void mult(int i , int a);
    void divide(int i, int a);
    void modulo(int i , int a);
    void menu();
    void driver();
    void driver2();
    int a,x,y,result;
    char choice;
};

void Calculator::add(int i, int a) {
    result = i + a;
    cout << "Result:" << result << endl;
}

void Calculator::subtract(int i, int a) {
    result = i - a;
    cout << "Result:" << result << endl;
}

void Calculator::mult(int i, int a) {
    result = i * a;
    cout << "Result:" << result << endl;
}

void Calculator::divide(int i, int a) {
    result = i / a;
    cout << "Result:" << result << endl;
}

void Calculator::modulo(int i, int a) {
    result = i % a;
    cout << "Result:" << result << endl;
}


void Calculator::menu() {
    cout<<"===============================================================\n";
    cout<<"                         MENU                                  \n";
    cout<<"===============================================================\n";
    cout<<"     1. Add\n";
    cout<<"     2. Subtract\n";
    cout<<"     3. Multiply\n";
    cout<<"     4. Divide\n";
    cout<<"     5. Modulo\n";
    cout<<"===============================================================\n\n";
    cout<<"===============================================================\n\n\n";
}

void Calculator::driver() {
    cout << "Enter your choice" << endl;
    cin >> a;
        cout << "Enter first number" << endl;
        cin >> x;
        cout << "Enter second number" << endl;
        cin >> y;
    switch(a){
        case 1: add(x,y); break;
        case 2: subtract(x,y); break;
        case 3: mult(x,y); break;
        case 4: divide(x,y); break;
        case 5: modulo(x,y); break;
    default: cout << "Invalid input. Try Again!" << endl;
    }

}

void Calculator::driver2() {
    do {
        driver();

    cout << "Do you want …
AndrisP 193 Posting Pro in Training

Value of space in ASCII is 32

AndrisP 193 Posting Pro in Training
#include <iostream>

int main () {
    int b,m,n;
    std::string s;
    std::cout<<"Input decimal number.\nInput \"0\" = end.\n\n";
    do  {
        std::cout<<"dec: ";
        std::cin>>n;
        m=n;
        std::cout <<"hex: "<< std::hex << n << '\n';
        std::cout <<"oct: " << std::oct << n << '\n';
        while(n>0){
            s+=(n%2)+48;
            n/=2;
            }
        std::cout<<"bin: ";
        while(s.size()>0){ std::cout<<s[(s.size()-1)]; s=s.substr(0,(s.size()-1)); }
        std::cout<<"\n\n";
        s="";
        }
    while(m>0);
    return 0;
    }