CS201 Assignment No 2 Solution Fall 2018 | Virtual Study Solutions

Adsetra Ads

 

CS201 Assignment No 2 Fall 2018

You can easily read or Download CS201 - Introduction to Programming Assignment No 2 Solution and Discussion of Semester Fall 2018. CS201 Assignment Due Date is 24 January, 2019. Total Marks are 20. We are here to facilitate your learning and we do not appreciate the idea of copying or replicating solutions. CS201 Assignment Solution File has been added. Previously we shared ISL201 Assignment No 2 Solution Fall 2018.

Download CS201 Assignment No 2 Solution Fall 2019


File NameDownload Link
CS201 Assignment No 2 Solution Fall 2019 Download



CS201 Assignment No 2 Solution Fall 2018
CS201 Assignment No 2 Solution and Discussion Fall 2018

CS201 Assignment Instructions

Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

  • Assignment is submitted after due date. 
  • Submitted assignment does not open or file is corrupt. 
  • Assignment is copied (From internet/ from other students). 
  • Assignment submitted in file format other than .cpp 

CS201 Assignment Allowed Software

In this Assignment of Introduction to Programming Software allowed to use are given below:
  • Dev C++ 
Recommended: DevC++ Installation and Usage Complete Guidelines


CS201 Assignment Objectives:

Student will be able to analyze and implement the concepts of:
  • Bitwise operators 
  • Class and objects 
  • Getter and Setter functions of the class 
  • Constructor 

CS201 Assignment Submission Instructions

You have to submit only .cpp file on the Assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.

Write a C++ program that will create a class named personalPassword.

This class will have two data members:
  • password of character type 
  • character type pointer passptr 
The personalPassword class will have the following member functions:
  1. The default constructor
  2. setter and getter functions for the password
  3. passEncrpyt() which convert the user entered password into encrypted form
  4. passDcrpyt() which convert back the encrypted password into the original password

  • Default constructor will initialize all data members with default values. The message “Default constructor called… and the default value of each data member should be displayed whenever an object will be created using default constructor.(See the sample output) 
  • In main() function, create an object of class personalPassword by using the default constructor. 
  • With the help of setter function, first you will set value of password and then with the help of getter function, you will display the actual password. 
  • Then call the passEncrpyt and passDcrpyt function in order to display the password in encrypted and decrypted form respectively.
Please Note: You have to use the bitwise operator (Exclusive OR) in order to generate the password in the encrypted and decrypted form.


 Sample output for the program is shown below:

Sample Output:

CS201 Assignment No 2 Solution Fall 2018 sample output

CS201 Assignment No 2 Solution Fall 2018

You can see the Sample Preview of Assignment No 1 Solution provided by (Virtual Study Solutions) below. Click on Download Button to Download Solution File in Your PC. Please Share it with your friends. You can also like our Facebook Page or Subscribe Us below for Updates.

Recommended : CS201 Latest Solved MCQs (23 to 45 Lectures)

CS201 Assignment Solution Code Sample Preview

Solution Code Sample Preview has been added below with Solution File.

#include <iostream>
#include <string.h>
using namespace std;
class PersonalPassword{
   private:
        char password[10];
           char *passptr;
   public:
   PersonalPassword(){
          strcpy(password, "Null");
            passptr = password;
       cout << "...................Default constructor called....................." <<endl;
       cout << "The default value of password is " << password <<endl;
    cout << "The default value of password pointer is" <<passptr <<endl;   
   }
     void setPass(){
       cout << "Please enter the password"<<endl;
        cin >> password;
     }
     char* getPass()const{
       return passptr;
     }
     void passEncrypt(){
       char taken = 't';
        for(int i = 0; i < strlen(password); i++)
            password[i] = password[i] ^ taken;
        cout << "The encrypted password using the passEncrypt() function is"<<password<<endl;
                     
               
        
     }
     void passDcrypt(){
       char taken = 't';
        for(int i = 0; i < strlen(password); i++)
            password[i] = password[i] ^ taken;
        cout << "The encrypted password using the passEncrypt() function is"<<password<<endl;
     }
             
};
int main(){
 
 PersonalPassword obj;
 obj.setPass();
 cout << "The password via getters function is " << obj.getPass() <<endl;
 obj.passEncrypt();
 obj.passDcrypt();
 
 return 0;
}

Test Code Output with Online C++ Compiler

Cick Here to Test Output

Online C++ Compiler Output preview:


cs201 assignment no 2 solution code online c++ compiler preview
online c++ compiler Solution output preview

CS201 Assignment Solution Download Link

Download  [ Solution File Upload Status : Done ]

Post a Comment

 

Top