Instructions

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

 

o        Assignment is submitted after due date.

o        Submitted assignment does not open or file is corrupt.

o        Assignment is copied (From internet/students).

 

Software allowed to develop Assignment

-          Dev C++

 

Objectives:

To enable students to exercise with  the concepts of:

·         Loops

·         Switch Statement

·         Functions

·         Arrays

·         Pointers

 

 

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.

 

 

Assignment

 

 

 

Write a program in C++ that will ask some programming related questions () from user and rank user according his / her answers in one of following categories:

 

1-      Beginner level

2-      Intermediate level

3-      Advanced level

 

For this purpose, your program will ask three questions from the user (as given in the screenshots below), record their response in the form of true and false (as or F) and store it in a character array using for loop.

 

You have to create a function named computeUserLevel () and pass that array to this function and receive the array as pointer within the function declaration. The function will determine and print the result that whether you are a beginner, intermediate or advance level user. If a user is not able to correctly answer any of the questions then user level will be set as beginner.

 

 

Note: Only use the following programming constructs in your program:

 

1.      A Character Array

2.      For Loop

3.      Switch Statement

4.      Function (Call by reference – receive array by using pointers)

5.      If else (only allowed in function)

 

      Otherwise your marks will be deducted accordingly.

 

 

Sample output:

 

 

                    

 

 

 

 

 

 

 

Deadline:

The deadline to submit your assignment solution is 28-May-2018. Your assignment must be submitted within the due date through VULMS. No assignment will be accepted through email after the due date.

Question File with SAMPLE OUTPUT attached.

Views: 737

Attachments:

Replies to This Discussion

Coding

#include <iostream>
using namespace std;

void computeUserLevel (char *) ;

int main()
{
char Y [4];
for (int k=0; k<=0; k++)
{
cout"arrays and pointers are same : ";
cin>> Y[0];
cout"switch is a loop : ";
cin>> Y[1];
cout"pointers store memory addresses : ";
cin>>Y[2];
}
computeUserLevel(Y);
return 0;
}
void computeUserLevel (char *ptr)
{
if (*ptr == 'f' && *(ptr+1) == 't' && *(ptr+2) == 't')
{
cout"your level is Advance";
}
else if (*ptr == 'f' && *(ptr+1) == 't' && *(ptr+2) == 'f')
{
cout"your level is Intermediate";
}
else
cout "your level is Beginner";
}

Is it true solution? 

nup there is some mistake...

bhai i have a question that is how we stop an array @ cout"pointers store memory addresses : ";
cin>>Y[2];

after this because its starts looping again showing messeg switch is a loop..kindly help me..

kindly upload the exact solution , without any mistake

RSS

Discussion Forum

CS201 Assignment # 2 Due Date: 28th May, 2018

Started by + caмe4ѕтυdιeѕ.
Last reply
by Shifaat May 27. 6 Replies

CS201 Assignment # 1 Due Date: 7th May, 2018

Started by + caмe4ѕтυdιeѕ.
Last reply
by Mani BSCS V May 7. 19 Replies

CS201 GDB Solution Fall 2017

Started by Cute S@mra Jan 11. 0 Replies

CS201 GDB

Started by Iqra Mubasher.
Last reply
by Javed Latif Jan 8. 4 Replies

SPONSORED LINKS

© 2018   Created by Muhammad Anwar Tahseen.   Powered by

Badges  |  Report an Issue  |  Terms of Service