Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6351153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:56:49+00:00 2026-05-24T21:56:49+00:00

Successfully Build, but Netbeans Run outputs stack trace Stack trace: Frame Function Args 0022C694

  • 0

Successfully Build, but Netbeans Run outputs stack trace

Stack trace:

Frame     Function  Args
0022C694  7570EFA3  (00000108, 0000EA60, 00000000, 0022C7B8)
..............
End of stack trace

I am reading a file line-by-line and check if they have vowel using C++ class concept.

I have tested read a file line-by-line and out to write a file line-by-line successfully without using C++ class.

Please help to point out where i should change my code. I guess there is memory management problems.

Thank you very much!

#include <cstdlib>
#include<fstream>
#include <iostream>

using namespace std;

class Password{
    private:
         char *pwd;
    public:
        Password(const char*pwd){
            setPassword(pwd);
        }
        ~Password(){
            delete []pwd;
        }
        void setPassword(const char *pwd){
            delete []this->pwd;
            if(pwd!=NULL){
                this->pwd=new char[strlen(pwd)+1];
                strcpy(this->pwd,pwd);
            }else{
                 this->pwd=NULL;
                }
        }
        char *getPassword(){
            return this->pwd;
        }
        bool containsVowel(){
            int i,counter=0;
            for(i=0;i<strlen(this->pwd);i++){
            if(this->pwd[i]== 'a' || 'e' || 'i' || 'o' || 'u' )
                counter++;
             }
            if (counter>0)
                return true;
            return false;
      }
};

int main(int argc, char** argv) {
    ifstream infile("C:/Users/user/Desktop/say.in"); 
    ofstream outfile("C:/Users/user/Desktop/say.out");
    string str; 
    while (getline(infile,str)){
       const char *pwd=str.c_str();
       Password pwdObj(pwd);
       if (pwdObj.containsVowel()==true){
    outfile<<"<"<<str<<"> is accpetable\r\n";
    }

    }
    infile.close();
    outfile.close();
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:56:49+00:00Added an answer on May 24, 2026 at 9:56 pm

    There are a couple of things. First one is that the pwd member of Password is not initialized, which will probably cause setPassword(...) to fail on the first call. You could initialize in your constructor like so (argument renamed to avoid confusion):

        Password(const char *apwd) : pwd(0) {
            setPassword(apwd);
        }
    

    The second problem is that containsVowel is quite broken as you’ve posted it. The variable i is also not initialized and I’m guessing there should be a loop — looks like it’s been omitted. Also there is a problem with the comparison that Delan has noted in his reply.

    You could also consider making the pwd member a std::string. It would make your life somewhat easier, both in terms of memory management, and finding vowels — I’m thinking you could use str.find_first_of(...) to find the vowels without iterating through all the characters yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an XML document successfully with the following code: public function build($result)
Here's the example . If you build and run TranslucentWindow in let's say, NetBeans
I am able to successfully build solution. but i keep getting this when i
The build of the project is succesfull, but when I go the the url
Has anybody successfully configured Teamcity to monitor, extract, and build from GitHub? I can't
Successfully used jquery-infinite-carousel in the past but for my current project I need it
I successfully installed the latest QuantumGrid from DevExpress, but I've never worked with this
Having successfully installed opencv 2.0 with python bindings I'm starting to run into trouble
Netbeans is returning a NoClassDefFoundError, but my class is right there! Has this happened
I am trying to run(emulate) a simple midp2 j2me application in netbeans(6.8) in ubuntu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.