Skip to content
  • 0 Votes
    9 Posts
    313 Views
    cyberianC

  • 0 Votes
    8 Posts
    4k Views
    cyberianC

    modules:composer.user_said_in, @cyberian, CS201 Assignment 1 Solution and Discussion

    Write a C++ program that performs the following tasks:
    1-Print your name and VU id.
    2-Add last 3 digit of your VU id.
    3-Display the result of sum on screen.
    4-Use if-else statement ::
    a) If sum is odd then print your name using while loop. Number of iterations of while loop should be equal to the sum.
    b) If sum is even then print your VU id using while loop. Number of iterations of while loop should be equal to the sum.
    [use remainder operator on sum value to determine the odd and even value for if condition]
    For example, suppose the student id is BC123456781. Then by adding last 3 digits of vu id, we get 16 which is an even number. In this case, program should print your VU ID for 16 times using while loop.

    // C201 Assignment No: 1 Fall2021 #include <iostream> #include <string> using namespace std; void printnameid(string studentid, string studentname); int calculatelastthreedigits(string studentid); int main() { string studentid="bc123456789"; string studentname="ZAHID"; printnameid(studentid,studentname); int TotalLastThreeDigits=calculatelastthreedigits(studentid); int counter=1; int a,b,c; a=6; b=4; c=0; cout<<"Sum of Last Three Numbers ="<<a+b+c; cout<<"\n\n"; if ( TotalLastThreeDigits % 2 == 0) // Divide by 2 and see if the reminder is zero? then it is even otherwise it is odd number { cout << "the sum is an even value: \n\n"; cout<<"++++++++++++++++++++++++++++++++++++++++++++ \n\n"; while(counter <= TotalLastThreeDigits) { cout << " Iteration: " << counter << "\n"; cout << "My student id is:" << studentid << "\n"; counter++; } } else { cout << "the sum is an odd value: \n\n"; while(counter <= TotalLastThreeDigits) { cout << " Iteration: " << counter << "\n"; cout << "My name is " << studentname << "\n"; counter++; } } return 0; } void printnameid(string studentid, string studentname){ cout<<"My name is " << studentname << "\n\n\n"; cout<<"My student id is:" << studentid << "\n\n\n"; } int calculatelastthreedigits(string studentid) { int end=studentid.length(); // Ending point that is total length of string int start=end-3; // Starting point string lastthreedigits=studentid.substr(start,end); // Trim the last three digits; int total=0; //Calculate the sum of last three digits for ( int index=0; index < lastthreedigits.length(); index++) { total += lastthreedigits[index] - '0'; } return total; // return the total to calling statement. }
  • 0 Votes
    1 Posts
    137 Views
    No one has replied
  • 0 Votes
    1 Posts
    161 Views
    No one has replied
  • 0 Votes
    1 Posts
    135 Views
    No one has replied
  • 0 Votes
    36 Posts
    1k Views
    cyberianC

    1
    Quiz # 1
    Dec 20, 2021 12:00 AM
    Dec 22, 2021 11:59 PM
    10

  • 0 Votes
    2 Posts
    115 Views
    cyberianC

    Quiz No.1
    Dec 13, 2021 12:00 AM
    Dec 15, 2021 11:59 PM
    10

  • 0 Votes
    2 Posts
    371 Views
    cyberianC

    Total Marks 5
    Starting Date Wednesday, December 01, 2021
    Closing Date Tuesday, December 07, 2021
    Status Open
    Question Title Auditor``s Report
    Question Description
    With reference to the Auditor’s Report, answer the following questions: (1.25 * 4 Marks)

    The recent final audit report of an FMCG carries a line which is read as … in the manner so required and respectively give a true and fair view of the state of the company’s affairs …… Briefly describe the meaning of “true and fair view”.
    An external auditor is not responsible for preparing his client’s financial statement. Why?
    Why do the notes annexed to the financial statements become an integral part thereof?
    List down any two matters upon which an auditor is bound to give his opinion.

    Important Instructions:

    Carefully review your GDB before submission on VU-LMS as it cannot be replaced once it is submitted.
    Your discussion must be based on logical aspects of the topic requirements with proper justification.
    There is a limit of 200 Words for discussion and your answer should be concise, relevant and comprehensive.
    Use the font style “Times New Roman” and font size “12”.
    Your answer should be relevant to the topic i.e. clear and concise.
    Do not copy or exchange your answer with other students. Two identical / copied comments will be marked Zero (0) and may damage your grade in the course.
    Books, websites, handouts and other reading material may be consulted before posting your comments; but copying or reproducing the text from books, websites, handouts and other reading materials is strictly prohibited. Such comments will be marked as Zero (0) even if you provide references.
    You should post your answer on the Graded Discussion Board (GDB), not on the Moderated Discussion Board (MDB). Both will run parallel to each other during the time specified above. Therefore, due care will be needed.
    Obnoxious or ignoble answer should be strictly avoided.
    You cannot participate in the discussion after the due date via email.
    Questions / queries related to the content of the GDB, which may be posted by the students on MDB or via e-mail, will not be replied till the due date of GDB is over.
    For planning your semester activities in an organized manner, you are advised to view schedule of upcoming Assignments, Quizzes and GDBs in the Course Calendar/Lesson Index of the course on VU-LMS.
    As you know that load shedding problem is also prevailing in our country. Keeping in view the fact, you are advised to submit your GDB well before time without waiting for the due date. For your convenience, you have been communicated well before time so that you can manage your activities, therefore no excuse will be entertained after due date of GDB.

  • earning on cyberian

    Moved General Discussion
    4
    0 Votes
    4 Posts
    178 Views
    cyberianC

    @triggered-man
    Just answer the question or post your questions and get reputations easily

  • what should we do.

    Moved General Discussion
    5
    1 Votes
    5 Posts
    131 Views
    cyberianC

    @triggered-man send you id technical team will confirm what is issue, we have no policy to block any id yet.

  • For health

    Health and Beauty
    1
    0 Votes
    1 Posts
    93 Views
    No one has replied
  • Vaccination certificate

    General Discussion
    1
    0 Votes
    1 Posts
    44 Views
    No one has replied
  • 0 Votes
    1 Posts
    99 Views
    No one has replied
  • 0 Votes
    1 Posts
    101 Views
    No one has replied
  • REVISION OF RESULT

    Announcements
    1
    0 Votes
    1 Posts
    105 Views
    No one has replied
  • 0 Votes
    1 Posts
    130 Views
    No one has replied