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 No. 02 Solution & Discussion Due Date: 27-01-2014

Views: 6491

Attachments:

Replies are closed for this discussion.

Replies to This Discussion

Ghulam Fatima Asghar

put the double less than sign after every cout...

like this..

isme eror hai dear k cout" thn agy ati hai ju dsplay krna huu....

cout k agy less the k 2 sign missng han

Dear Students,

all solutions r correct. errors r occur just due to missing less than sign every cout.

Coz, Here less than signs do not show when code is pasted.

so, no need to worry... if facing any error in coding, just paste here. 'll try to do it correct.

کزہ u r Most welcome..

plzzz yah chk kar k batyn thk hai yah ni

Attachments:

#include<iostream.h>
#include<conio.h>
class myClass
{
private :
char*str, alphabet;
public:
myClass()
{
str = new char[10];
cout"Default Constructor is called ..... and default id is bc110401299 \n";
}
void setId(char *id)
{
str = new char[10];
strcpy(str,id);
}
char * getId()
{
return str;
}
void countfunction()
{
cout"\nEnter letter you want to count: ";
cin>>alphabet;
int i =0, count = 0;
while(str[i] != '\0')
{
if(alphabet == str[i])
{
count++;
}
i++;
}
cout"The total letters "alphabet" in your student id : "countendl;
}
~myClass()
{
delete[]str;
cout"\nDestructor called ...... and object has destroyed \n";
cout"Press any key to continue ..... ";getch();
}
};
main()
{
myClass obj;
obj.setId("bc110401299");
cout"Your id is " obj.getId();
obj.countfunction();
}

strcpy(str,id);

[Error] 'strcpy' was not declared in this scope

u missed in coding

using namespace std;

write it as above

#include<iostream.h>
#include<conio.h>

using namespace std;

can any one tell me please when i run program i am facing this error how to resolve it ?

write just..

#include<iostream>

#include<iostream.h>

but error a raha hy #include<iostream.h> kea hy phr b system says 1 21  [Error] iostream.h: No such file or directory

1

2

3

4

5

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

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

Management: Admins ::: Moderators

Other Awards Badges List

Latest Activity

+ Diamond Heart liked + ♥ Haniya khan's discussion Dost
6 minutes ago
6 minutes ago
6 minutes ago
+ Diamond Heart liked + ♥ Haniya khan's discussion Maf Karny Waly bano
6 minutes ago
6 minutes ago
Mani Siddiqui posted a status
"لوگ اچھے ہیں, میرے گرد مگر کیا کجیۓ روز اب شخص کہاں دل کو کوئی بھاتا ہے ♥️"
8 minutes ago
+ ₱ɆⱤ₣Ɇ₵₮ ҉S҉M҉O҉K҉ER ⱫɆⱠⱠłsH ♥♥ posted discussions
25 minutes ago

2 hours ago