AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Languages, Compilers and Interpreters C,C++,C#,.NET,Java,PHP,Perl,SQL and more

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Apr 4, 2006, 18:18  
Младенец
 
imjustagirl's Avatar
 
Join Date: Mar 2006
Location: san fan
Posts: 15
Rep Power: 0
Reputation: 10
vaild account

hello can some one help me here
i have to accept a number
and preform a linear search for the numbers

and if its not one of the number it has to say its invalid
but i keep getting and error for to many int

#include <iostream>
using namespace std;
int searchlist (int[],int,int);
int main()
{
const int Num_Account = 18;
// Error here char Account[Num_Account]=
{5658845, 4520125, 7895122, 8777541, 8451277, 1302850,
8080152, 4562555, 5552012, 5050552, 7825877, 1250255,
1005231, 6545231, 3852085, 7576651, 7881200, 4581002 };

cout << "enter Number\n";
cin >> num;

int searchlist(int list [],int num,int value)
{
int index = 0;
int position = -1;
bool found = false;

while (index < num &&!found)
{
if (list [index] == value)
{
found = true;
position = index;
}
index++;
}

return 0;
}
imjustagirl is offline   Reply With Quote Quote selected
Old Apr 6, 2006, 08:12   #16
Silence
 
Moonlight's Avatar
 
Join Date: Nov 2004
Location: back to meta level
Posts: 3,924
Blog Entries: 3
Rep Power: 5
Reputation: 189
Send a message via Skype™ to Moonlight
Re: vaild account

Quote:
Originally Posted by acid
is this your homework at uni?
or maybe it's his job & he's earning money in forum. acid, charge taxes!

p.s. oy do chego j bivayu vrednoy
Moonlight is offline   Reply With Quote Quote selected
Old Apr 10, 2006, 02:23   #17
Дошкольник
 
Diane-'s Avatar
 
Join Date: Apr 2003
Location: USA
Posts: 103
Rep Power: 6
Reputation: 10
Re: vaild account

that should work and stop after valid number was found. You can change condition to search entire array by removing boolean flag, . Its a simple program and should be able to do it yourself .

Code:
#include <iostream>
using namespace std;
void searchlist (double [],int,double);
const int index = 18;
int main()
{
double num;
double Account[index]=
{5658845, 4520125, 7895122, 8777541, 8451277, 1302850,
8080152, 4562555, 5552012, 5050552, 7825877, 1250255,
1005231, 6545231, 3852085, 7576651, 7881200, 4581002 };

cout << "enter Number\n";
cin >> num;

searchlist(Account,index,num);
system("pause");
return 0;
}

void searchlist(double list [index],int index,double value)
{
     bool found=false;
     int i=0;
     
          while (i<=index && !found)
          {
          if (list [i] == value)
            {
            cout<<"Valid"<<endl;
            found=true;
            }
          else
            cout<<"Invalid"<<endl;
          i++;
            }
}
__________________
No se preocupe, sea feliz !
Diane- is offline   Reply With Quote Quote selected
Old Apr 12, 2006, 02:54   #18
Младенец
 
imjustagirl's Avatar
 
Join Date: Mar 2006
Location: san fan
Posts: 15
Rep Power: 0
Reputation: 10
Re: vaild account

im a girl and no its not for a job its just homework in a class i am taking a majority of the programs i write on my own but i tend to get stuck on some things. so i ask for help in on here much easier then getting a hold of my professor. i got the account validation to work good but thanks for the help Diane, this is the first time i have even tried programing i just learned how to use the internet :-( sad huh.
imjustagirl is offline   Reply With Quote Quote selected
Old Apr 12, 2006, 07:55   #19
Easy rider
 
Silver's Avatar
 
Join Date: Nov 2005
Location: tristeza
Posts: 1,085
Rep Power: 4
Reputation: 10
Send a message via ICQ to Silver
Re: vaild account

Woot, Girl Power!
__________________




You must spread before giving to Silver again.
Silver is offline   Reply With Quote Quote selected
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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Offering gmail account invitation for free! acid English Only 173 Apr 21, 2006 09:04
Could Anybody Help to Create New Gmail Account nissankale General 32 Apr 5, 2005 09:11
New Free email account with 3GB! Red Stone Web sites 5 Oct 30, 2004 20:41
Gmail Drive - Change your mail account into a 1GB hard drive Red Stone Software 1 Oct 8, 2004 18:52
How to open Paypal account acid General 4 Sep 3, 2004 05:08


All times are GMT. The time now is 18:22.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link