Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~2K People Reached
Favorite Forums
Favorite Tags
Member Avatar for lastbencher

I made the following functions for deleting a node of a singly linked list. 1. Can these functions be improved furthur? 2. Is it necessary to free the memory of the node that is deleted? nodep deleteByValue(nodep p, int value) { nodep temp = p; if(temp->data == value) return temp->next; …

Member Avatar for sethlahaul
0
212
Member Avatar for lastbencher

Program: #include <iostream> using namespace std; class Rectangle { float len; float bre; public: Rectangle() {cout << "Rectangle constructed!" << endl; len=0; bre=0;} ~Rectangle() {cout << "Rectangle destructed!" << endl;} void setL(float L) {len=L;} void setB(float B) {bre=B;} friend float area(Rectangle rect); }; float area(Rectangle rect) { return rect.len*rect.bre; } …

Member Avatar for JasonHippy
0
166
Member Avatar for lastbencher

[code=c] #include <iostream> #include <sstream> using namespace std; int main(void) { string str; int i; cout << "Enter an integer: "; getline(cin, str); while(true) { stringstream ss(str); if (ss >> i) { break; } else { cout << "\nPlease enter a valid number: "; getline(cin, str); } } cout << …

Member Avatar for zeroliken
0
219
Member Avatar for lastbencher

C++ course has started in my college. I would like to know the best beginner book for C++. My teacher has referred Robert Lafore and The Complete Reference. Since there are a lot of suggestions given in the sticky thread, I am confused. Thanks in advance :)

Member Avatar for lastbencher
0
224
Member Avatar for lastbencher

[code=c] #include <stdio.h> int main (void) { float a; a = 7/3; printf ("%f\n", a); } [/code] Result : 2.000000 Why is gcc compiler printing 0 after decimal?

Member Avatar for mridul.ahuja
0
144
Member Avatar for lastbencher
Member Avatar for lastbencher

I was trying to print the location of array elements using the following code [code=c] #include<stdio.h> main() { int arr[]={10,20,30,40,50,60}; int i; for (i=0; i<6; i++) printf("%d ", &arr[i]); return 0; } [/code] Error: [B]printArrayLocation.c:7:3: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’[/B] While i …

Member Avatar for Narue
0
168
Member Avatar for lastbencher

The following code is given in my Data Structure reference book. [code=c] #include<stdio.h> main() { int i, *pi; float f, *pf; pi = (int *) malloc(sizeof(int)); pf = (float *) malloc(sizeof(float)); *pi = 1024; *pf = 3.14; printf("an integer = %d, a float = %f", *pi, *pf); free(pi); free(pf); } …

Member Avatar for lastbencher
0
153
Member Avatar for lastbencher

This code is not running. i'm using gcc [code=c] #include<stdio.h> int main() { struct book { char name[10]; float price; int pages; }; struct book b[5]; int i; for (i=0; i<5; i++) { printf("Enter name, price and pages\n"); scanf("%c %f %d", &b[i].name, &b[i].price, &b[i].pages); } for (i=0; i<5; i++) printf("%c …

Member Avatar for lastbencher
0
122
Member Avatar for lastbencher

Hi I installed Visual C++ 2010 express today. There is no option to create a .C file. I tried googling but found nothing. Please help me with this

Member Avatar for mitrmkar
0
306