www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Assignment#02 Solution & Discussion Due Date:22-11-2010

Solution::

#include <iostream>

using namespace std;

voidmain()

{

int i=1; //counter for while loop

int Acounter=0; //counter for A grade

while (i<=10)

{

startwhile:

{

Acounter=Acounter+1;

}

{

goto startwhile;

}

i=i+1;

}

coutendlendl"Total No. of A Grades: "Acounterendl;

if (Acounter<=2)

{

}

else if (Acounter<=7)

{

}

else if (Acounter<=8)

{

}

coutendlendl;

} //bye bye

Views: 606

### Replies to This Discussion

AASSignment 201 Programming start discussion
Attachments:
Need idea ........?

This assignment needs to be done using functions as specified in the question. This could have been improvised by calling a function twice to fill up both arrays instead of using two for loops. Secondly the program should have covered three scenarios for the matching, 1. if 10 of the elements are identical, give the message, 2. if all 10 elements are different, give the relevant message, AND 3. IF SOME ELEMENTS ARE IDENTICAL THAN INDICATE WHICH ONES

so for the ones copying this program BEWARE
Plz upload solution. and tell me do i need to upload C++ programe file or simply write programe in MS-word file and upload it?
#include

using namespace std;

void main()
{
int i=1; //counter for while loop
int Acounter=0; //counter for A grade

while (i<=10)
{

startwhile:

{
Acounter=Acounter+1;
}

{
goto startwhile;
}
i=i+1;
}

coutendlendl"Total No. of A Grades: "Acounterendl;

if (Acounter<=2)
{
}

else if (Acounter<=7)
{
}

else if (Acounter<=8)
{
}
coutendlendl;
} //bye bye
Attachments:
Need solution for 2nd assignment
dear brothers and sisters

Mani has come again with the solution of cs201 assignment 2. get idea from here and make your own.
Attachments:
Good try, but again this could have been made more elegant by calling a function twice for filling up both arrays. Secondly as a good programming practice, the called function "match" should only compare and give result to the calling function, and the decision upon the result should have been made by that calling function. This would have made the function "match" more generic. Also instead of using constant values of 10, at every place, a constant variable of value 10 would have made the program more flexible.
can u plz make it more elegant by calling a function twice for filling up both arrays?
I won't write the complete code but I will give you the following hint.

#include<...>
.
.
void fillUpArray(int const*);
const int MAX = 10;
.
.
.
int main(){
int array1[MAX] = {0}, array2[MAX] = {0};
.
.
fillUpArray(array1);
fillUpArray(array2);
.
.
.
}
plz upload the solution of assignment 02

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

### Jannah ? Hold you deen tight.

3 minutes ago
1 hour ago
2 hours ago
Muhammad Bilal replied to BBA(6th smes)'s discussion assignment 1 spring 2021 in the group MGT402 Cost & Management Accounting
3 hours ago
★---★ ⱮԱϚҠȺហ ȺచȺហ ★---★ updated their profile
3 hours ago
Mani Siddiqui posted a discussion

5 hours ago
5 hours ago
5 hours ago