Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
50% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
~10.8K People Reached
Favorite Tags

22 Posted Topics

Member Avatar for MRehanQadri

Suppose I'm running a loop and the loop should continue unless I get a garbage value. So what will be the terminal condition. How can garbage value be checked in if condition?

Member Avatar for Reverend Jim
0
4K
Member Avatar for shqiptari88

If you'd have also written its solution then many (like me) would have got benefit from that.

Member Avatar for MRehanQadri
0
797
Member Avatar for MRehanQadri

char* f(){ char* result;//I have to return 'result' at the end of this function, where result should be containing i (i.e. int i=97) in it. int i = 97; //Do whatever you can return result; }

Member Avatar for Ancient Dragon
0
402
Member Avatar for MRehanQadri

Suppose my file a.txt has "ABC" written in it. Now I want to write a small b before capital B in the file. How will I do it? I've tried to do it but i'm having problems. 1. When opened in app mode seekp doesn't work. 2. When opened normally …

Member Avatar for MRehanQadri
0
228
Member Avatar for MRehanQadri

#include <iostream> #include <fstream> using namespace std; class a{ public: void set(int x){num = x;} int get(){return num;} private: int num; }; int main(){ ofstream o_("test.txt"); o_.close(); ofstream os("test.txt", ios::binary | **ios::app**); a o; o.set(1); os.write(reinterpret_cast<char*>(&o), sizeof(a) ); // a o2; // o.set(2); // os.write(reinterpret_cast<char*>(&o), sizeof(a) ); os.close(); a o3,o4; …

Member Avatar for MRehanQadri
0
2K
Member Avatar for MRehanQadri

Kindly Remove its errors and tell me the reason for the error. Code: https://www.box.com/s/enl4h6loqcnc7jqqgujq

Member Avatar for MRehanQadri
0
187
Member Avatar for MRehanQadri

[code]#include <iostream> #include <fstream> #include <conio.h> #include <ctime> using namespace std; //////////////////////////////////////////////////////////////////////////////// class account{ public: account(){ i = 0; balance = 0; transaction_during_one_day = 0; one_month_balance = 0; minimumBalance = 99999999999999; startTime = clock(); } //```````````````````````````````````````````````````````````````````````````````````````````````` void depositBalance(){ cout << "Enter Amount to Deposit: "; cin >> depositAmount; balance += …

Member Avatar for MRehanQadri
0
85
Member Avatar for MRehanQadri
Member Avatar for MRehanQadri

See the highlighted portion (in yellow) the definition of copyConstructor at http://libraryofcprograms.blogspot.com/2013/03/copyconstructor.html Why haven't we used obj.getX() ? void a::copyConstructor(a &obj){ x = obj.x; //should have used obj.getX() because we're accessing a private member of obj? }

Member Avatar for Nutster
0
153
Member Avatar for MRehanQadri

http://libraryofcprograms.blogspot.com/2013/03/initializing-character-array-structs.html Is there any other way to initialize a chararcter type array in structs?

Member Avatar for MRehanQadri
0
102
Member Avatar for MRehanQadri

Let f1 and f2 are two user defined functions. main(){ int *p; f1(&p) } f1(**p){ f2(&p);//If I've to pass the pointer by reference again in another function, will I've to do something like this? } f2(***p){ **p = NULL; }

Member Avatar for MRehanQadri
0
183
Member Avatar for MRehanQadri

If p is a pointer pointing a node to be deleted, then what's wrong in the following code: cout << "Do you want to delete this record? (y/n) "; if (getch() == 'y' || getch() == 'Y'){// Delete record. if (p == *ph){//If first node is to be deleted. *ph …

0
82
Member Avatar for MRehanQadri

We cannot use constructors if we want that whenever a pointer is declared, it should be NULL. Am I right Sir? if I declare student *head, *tail, where student is a class, can I make my pointers automatically make NULL using default constructor?

Member Avatar for Moschops
0
170
Member Avatar for MRehanQadri

If the prototype of my function is void sell_item(store **head,store **tail). In main i've passed sell_item(&head,&tail), where head & tail where both pointers of store(struct) type. Now I want to access the the content where head is pointing to. How shall I access it? Like *head->next??? But this is not …

Member Avatar for MRehanQadri
0
168
Member Avatar for MRehanQadri

Can't find out the error. #include <iostream> using namespace std; struct node{ int id; int *next; }; node * get_data(int ); node * get_data(void); void insert_node (node **, node **, node *); void display_data(node *); int main(){ node *head=0, *tail=0, *newPtr=0; newPtr = get_data(); insert_node (&head,&tail,newPtr); display_data (head); return 0; …

Member Avatar for deceptikon
0
193
Member Avatar for wids101
Member Avatar for MRehanQadri

#include <iostream> using namespace std; struct td{ int ** subj_no; }; int main(){ td p; **p.subj_no = new int * [7]; } If not then how should I accomplish this task? What's the corrected version?

Member Avatar for vmanes
0
175
Member Avatar for wschamps42

What I know is that the size of Pointers vary according to the size of Address. Since pointer is normally considered of 4 bytes (whatever its type may be int,double etc.), so size should be 4*4 = 16. You can check it by executing the following code: double *arr[4]; cout …

Member Avatar for rubberman
1
278
Member Avatar for MRehanQadri

int x; cin >> x; //If user writes 05 in x. Then I want that 05 should be printed when we cout << x; //If user writes 005 when prompted for x then printing x should print 005, because 005 may be a telephone extension. Is there any way?

Member Avatar for Ancient Dragon
0
194
Member Avatar for MRehanQadri

Kindly write a simple code to produce a form, where Subject & Message is displayed and when user clicks on submit button, and e-mail is sent to me, with the same subject as the user mentions. My e-mail address should not be displayed. I've been searching web for more than …

Member Avatar for MRehanQadri
-1
241
Member Avatar for MRehanQadri

My Thinking: struct student { int *subjects_number = new int [NoOfSubjects]; } main() { int NoOfSubjects; cin >> NoOfSubjects; } Objective: students could have taken different number of subjects. Now modify the structure such that its variable subjects_numbers has type pointer to int so that we can store scores for …

Member Avatar for mike_2000_17
0
135
Member Avatar for MRehanQadri

Why the condition if ((a[0] == 'y') | (a[0] = 'Y')) is ALWAYS TRUE in the following code? #include <iostream> using namespace std; int main() { cout << "Enter 10 integers seperated by spaces: "; int array[10]; for (int i = 0; i<1; i++) cin>>array[i]; cin.ignore(); cout << "Do you …

Member Avatar for MRehanQadri
0
686

The End.