User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,772 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 537 | Replies: 1 | Solved
Reply
Join Date: Nov 2007
Posts: 14
Reputation: ENG ISE student is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ENG ISE student ENG ISE student is offline Offline
Newbie Poster

Help unknown error

  #1  
Dec 4th, 2007
I am getting an error i dont recognize and dont know what to do to fix it and input would be great. The error is:
prog4.cpp:23: error: no matching function for call to 'std::basic_istream<char, std::char_traits<char> >::get(char [500])'

#include <iostream>
#include <ctype.h>
#include <cstring>

using namespace std;

void encrypt(char ch, int count, int num, char phrase[]);

int main()
{
        char ch, phrase[500];
        int count, i, num, flag = 0;

        cout << "Please enter a phrase you wish to be encrypted then press enter.";
        cin >> phrase;
        cout << "Enter you favorite number to encrypt phrase with.";
        cin >> num;

        count = strlen (phrase);

for (i = 0; i < count; i++)
{
        ch = cin.get(phrase);

        if (ch == '\n')
        {
                break;
        }
        else
        {
                if (ch == ' ')
                {
                        flag = 1;
                        continue;
                }
                else
                {
                        if (flag == 1)
                        {
                                flag = 0;
                                toupper(ch);
                                encrypt(ch, count, num, phrase);
                        }
                encrypt(ch, count, num, phrase);
                }
        }
}
}

void encrypt(char ch, int count, int num, char phrase[])
{
                if (count<=num)
                {
                        cin >> phrase;
                        ch = cin.get();
                        ch = ch + count;
                        count++;
                }

                else
                {
                        count = 1;
                        cin >> phrase;
                        ch = cin.get();
                        ch = count + ch;
                        count ++;
                }

}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: unknown error

  #2  
Dec 4th, 2007
>> ch = cin.get(phrase);
the get function doesn't take a parameter
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 9:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC