DB Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

SELECT * FROM `user` the_table WHERE the_table.userid = DB Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

SELECT * FROM `user` the_table WHERE the_table.userid = C++ Algorithm Help? - iTechForums
Login
Search
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 2
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2008, 09:24 AM
Zack G Zack G is offline
Junior Member
 
Join Date: May 2008
Posts: 2
Default

C++ Algorithm Help?


I don't even know where to begin on this problem somebody please help me out. If you don't know please do not answer!

Write an algorithm to read a sequence of integers, ignoring all numbers that are less than 1. Count how many even and odd numbers there are, and print these counts. For example, with input 7 25 100 2 -6 1 0 3, the output should be
Even = 2, odd = 4
There were two even numbers (100 and 2), four odd numbers (7, 25, 1, and 3), and two numbers were ignored (-6 and 0). Your algorithm should work for any input, not just this example.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-12-2008, 09:25 AM
Some Guy Some Guy is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default

It's been a LONG time since I wrote any C++, so I can't / won't write your whole program for you.

You need an odd counter and an even counter variable. Decide how many numbers you will evaluate. That will be your FOR loop count. Initialize your counters.

to determine odd or even, use modulus. I forget what the mod operator is in c++. I also forget the syntax of the CIN and COUT etc... and you have to include iostream, or something like that...

int oddCount = 0;
int evenCount = 0;
int userInput = 0;

for(int i=0, 6, i++)
{
CIN>userInput;
if(userinput>0)
{
if(userInput%2 == 0)
evenCount++;
else
oddCount++
}
}

COUT yer variables.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Why is the prim's algorithm greedy? Does the algorithm always return a correct peiyi l Software Design & Algorithms 1 05-06-2008 04:51 PM

Your Ad Here

All times are GMT. The time now is 08:34 PM.