Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-10-2005, 07:02 PM   #1 (permalink)
djlove105fw
Registered User
 
Join Date: Feb 2005
Posts: 3
djlove105fw is on a distinguished road
help, I am new with c++

This my next Program and I would like some help how to start it.

A local bank has instituted a new credit system and would like to have account numbers that are self-checking in order to have some protection against fraud and clerical errors. They have devised a system a follows:

The account numbers will be nine digits long and the ninth digit(rightmost)can be calculated by either adding, subtracting, or multiplying all of the preceding digits and finfind the rightmost digit of the result. If the two righmost digits match, the account numbers is valid.

In the operation code(the first digit), 1 is addition, 2 is subtraction, and 3 is multiiplication. Any other digit in this position is incorrect.

Your job is to write a program that will check the validity of an account number that has been sent to the bank as part of its daily transaction.

INPUT: a nine-digit account number.
OUPUT: Echo print the input, followed by account status.
(Either VALID, INVALID, or OPERATION CODE ERROR)

EXAMPLE: 123456786
1+2+3+4+5+6+7+8=36

6 is the rightmost digit in both the account number and the
result of the operation. Therefore, the account number is
VALID.

EXAMPLE: 312131413
3*1*2*1*3*1*4*1=72

The righmost digit of the result of the operation is 2, but
the rightmost digit of the account number is 3. This account
number is INVALID.

#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char ch;
ifstream ifout;
ofstream ifout;
int val, char number[9];
ifout.open("data.txt",ios::in);//I have to creat data.txt file also//
if(!ifout)
{
cout<<"Error: Coul not openfile" <<endl;
exit(1);
)
Cout << "Enter a nine digit"<<endl;

I am having problems with the ( for loop ) I don't know how to have the user to Enter the 9 digit nubers and then add them or subtract them together.

if some can help, that would be nice.
djlove105fw is offline   Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM
VB or C#, or something else Apodysophilia MS Technologies ( ASP, VB, C#, .NET ) 6 10-15-2004 09:48 AM
operate overloading member function in C# sureshkumar_kc MS Technologies ( ASP, VB, C#, .NET ) 2 10-15-2004 02:36 AM
edit? anon Lounge 10 11-21-2002 03:02 PM


All times are GMT -8. The time now is 04:36 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting