- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
electrical & computing engineering
- Interests
- programming, mathematics, sports, music
37 Posted Topics
Hello everybody! I have two questions about pointers and would be grateful if someone gave me some help. 1. When we use a table's name as a parameter the table is used as an address (the address of its first element). I mean, when i call a function that has … | |
Re: Hello, firstly your function setMember has no returning type. Your example doesn't work either way? Is your compiler complaining about something? | |
Hello everybody, I wrote a test source code about 2 classes point and circle. These classes illustrate the center of a circle (point class) and its radius (circle class). Circle class inherits point class. Here's the code: [CODE]#include <iostream> using namespace std; class point { private: int x, y; public: … | |
Hello everybody! I wrote an example about a copy constructor and the result wasn't what i expected. Here's the example: [CODE] #include <iostream> using namespace std; class A { public: A(const A& cp); A(double t[], int size); ~A(); double *getTab() const { return tab; } double *tab; int size; }; … | |
Hello everybody! I wrote the following classes: OilStation: [CODE] class OilStation : public Date{ protected: int code; char *Address; float Amount[K]; public: ... }; [/CODE] and Price: [CODE] class Price : public OilStation { public: Price(){} void changeAmount(); ... }; [/CODE] In changeAmount function i try to change the elements … | |
Re: [QUOTE=thunderwolf07;1406728]can someone explain me what is the meaning of the number after the modulo (%) EX. printf("the number is: %10.2f", number); please help me define and understand the number after the % and give example, thanks![/QUOTE] Hello, with %10.2 you specify the format in which your float number will be … | |
Re: [QUOTE=jeremy62;1402948]so basically i wrote a progarm that begins with a menu allowing you to select one of 5 functions, but at the end of whichever function i would like it to return to the menu the problem is i dont know how to do that and would like any tips … | |
Re: [QUOTE=GURU1349;1403049]I'm a beginner in C++. I'm not studying it so I don't have a teacher and I don't have a book, a guide. The Internet is my only guide. Well here's my program: [CODE]#include <iostream> #include <math.h> using namespace std; int main () { int q; float x,y; Baslangic: cout … | |
Re: [QUOTE=knnccb;1382489]i just got an exercise i am asked to do and i have no idea what to do. I am asked to use recursive to print a pattern without using loop: * ** *** **** **** *** ** * And also : **** *** ** * ** *** **** Any … | |
Re: [QUOTE=berwick53;1402996]Hi i've just started to use constructors and I'm having some problems with the following code with data not saving(saving to the correct place) please Help :( [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> typedef struct details // struct for all data { char name[50][50]; char card[50][16]; long sort[50], … | |
Hello everybody! I want to ask something that crossed my mind today about strcpy..I wrote the following piece of code and although i didn't expect it to work..it worked! [CODE] #include <iostream> using namespace std; int main() { char name[20], *dname; cout << "what's your name?: "; cin.getline(name, 20); strcpy(dname, … | |
Hello! I've written a class called Date: [CODE] class Date { private: int day, month, year; public: Date(); Date(const char *d); //other methods... }; [/CODE] I want to write a constructor that'll take as a parameter (as you can see) a c-string. That string will look like: "12022010". The first … | |
Re: [QUOTE=LilProblems;1386928]Hi guys. I am hoping for a little help with this. I am pretty new to programming and just can't seem to get things right yet. Here is my code. It returns like 40 errors. Way messed up eh? [CODE]#include <iostream> #include <string> using namespace std; class Date { public: … | |
Re: [QUOTE=cortez716;1386973]Okay heres the background on the code. I've written a code that prints a 10x10 array or random numbers. Then prompts the user to pick a number. After user picks a number, the program then tells user the number of times number was found in the array and supossed to … | |
Re: [QUOTE=geryin;1387014]Write a function that accepts an array of integers and determines the difference between the integers. For example, if the array [3 7 8 13 11] is passed to the function, it prints to the screen [3 4 1 5 -2]. mine give me : 3, 4 ,4 9, 2 … | |
Re: [QUOTE=gizmo7008;1386878]I'm trying to create a print void function, however I'm not understanding how to call the database in the print function. I've tried to do something similar to what is in my textbook but all I'm getting is errors. This is what I've done so far. [CODE] #include <iomanip> #include … | |
Re: [QUOTE=Ace1.0.1.;1385267]I just want modify the program below to print + or - minus after the letter grade based on the last digit. [CODE]// Chapter 6 - Exercise 1 // A professor generates letter grades using /* 0 - 60 F 67 - 70 D 71 - 80 C 81 - … | |
Re: [QUOTE=Nathaniel10;1385143]This is part of my Wumpus Hunt program. Suggestions were to clean up the main() part of the program by creating functions. I am working on that and ran into this difficulty (for me). The functions that relate to the rooms of the game need to return an array. I … | |
Re: [QUOTE=Urv73;1385269]I have a program that lets me enter participants in a race, their startingnumber, their start time and end time. The program then tell me who won the race and the winning time. This is my program: [CODE] #include <iostream> using namespace std; int main () { int start_Nr, start_Hour, … | |
Re: [QUOTE=Rickay;1382196][CODE]int main2() { cin.get(); cin.ignore(); cin.clear(); while(true) { long double x, y; char ch_op; Sleep(200); cout << "Enter an expression below: \nExamples:\n"; cout << "x + y for Addition.\nx * y for Multiplication.\n" << "x / y for Division\nx - y for Subtraction.\nx & x for Square Roots.\n" << "x … | |
Re: > this coding is in the class of set! Set::setDifference(int elements,int& z) { int a,b; z=(elements*a,elements*b); int temp; for (int i=0; i<=elements; i++) { *temp[i]=set[i]- z.set[i]; } return temp; } > end quote. I really can't understand what you intend to do...:-O Please be more specific and your code is … | |
Re: [QUOTE=aaronmk2;1379258]Can someone explain and give an example of how double hashing works. I understand linear, quadratic, and chain.[/QUOTE] Hello, did you check that out? [URL="http://en.wikipedia.org/wiki/Double_hashing"]http://en.wikipedia.org/wiki/Double_hashing[/URL] | |
Re: [QUOTE=KellieD;1381000]Hi, Would be very grateful if someone could tell me how to start an array by getting the program to ask you how many values you want to enter (the maximum being 50) Thanks :)[/QUOTE] Hello! One way to do this is with a dynamic array. I'll give you an … | |
Re: [QUOTE=claudiordgz;1381111]I guys, i have a problem with binary files A file is opened in the beginning of the main then a case to give the user a choice: 1.- Show the content of the file 2.- Search for a name 3.- Search for a type of crime 4.- Search for … | |
Re: [QUOTE=skiabox;1379133]I am trying to use a vla (variable length array) in my code but I see that the array is not initialized properly when I debug the program. Here's the code : [code] #include <stdio.h> #include <stdbool.h> int main (int argc, const char * argv[]) { // insert code here... … | |
Re: [QUOTE=aaronmk2;1377702]My profesor added this line of code to a bubble sort saying that it made it more efficient by tracking the last swap. I don't understand how this would work [CODE] void bubble_sort(int a[], int n){ while (0<n-1) { int last =0; for (int i=0; i<n-1; i++) { if (a[i]>a[i+1]) … | |
Re: [QUOTE=Sohelp;1377588]Hello All, I can not understood what is function Overloading? Please help me........ Your Regard Sohel Rana Bangladesh[/QUOTE] Hello, you can write in your program functions that will have the same name. When you call in your program one of these functions you have to make clear which function will … | |
Re: [QUOTE=y9john;1374284]Hi guys, I am working on a program for my c class and I was wondering anyone knows if it is possible to define a structure that has dynamic members. I think I saw a thread on this already but when I read it, it didn't quite make sense. This … | |
Re: Hello! I had something easier on my mind.. such as a function that takes as a parameter an array of characters and returns 1 if the content of the array is palindrome and 0 if the content of the array isn't palindrome..In order to check if the character sequence is … | |
Re: [QUOTE=Goshutu;1373349]my program is made to enter a matix,in which it finds all of the column`s minimum numbers which are[COLOR="Red"] >0[/COLOR] and then put them under the last row.i have sucseded entering the array and puting it out,but i think my IF is wrong somehow.I have tried initialising the last row … | |
Hello everybody! I need to move the get pointer of a text file at the beginning so i wrote in my program the following line (knowing that in a binary file really works): [code=c]ifstream in; in.open("data.txt", ios::in); in.seekg(0, ios_base::beg); [/code] but...in my text file doesn't really work. Is there a … | |
Hello everybody! I have a little problem in a piece of code that seems quite simple. This piece of code reads float numbers till the user hits the number -999.9. When he/she does then the program ends. So i write [code=c]float n; scanf("%d", &n); while (n != -999.9) { i++; … | |
Hello everybody. I want to make a piece of code that its main job will be to swap rows in a 2d char array. I wrote the following piece of code: [CODE]#include <iostream> using namespace std; void swap(char *s1, char *s2); int main() { char arr[3][10]; cout << "give me … | |
Re: I tried that and worked. Why don't you give it a try: [CODE]#include <stdio.h> #define M 5 float* return_array(int size); main() { int i; float *t; t=return_array(M); printf("the elements of t array are:\n"); for (i=0; i<M; i++) printf("%f ",t[i]); printf("\n"); system("pause"); } float* return_array(int size) { int i; float *temp; … | |
Hello everybody! I want to write a program in c that has to open a file (a c program) and count how many char or double declarations have been made in it, so as to calculate the amount of memory that char and double data types will occupy in memory. … | |
Hello everybody! Recently while i was experimenting with some code written in c++ i noticed something that confused me a bit. In that code i had to deal with 2 structs : [code]struct date { string day; int month; int dday; int year; }; [/code] and the other struct [code]struct … | |
Hello everybody! This forum gave the greatest impression so congratulations to you folks who built it. I'm not an expert in c++, i've actually started learning a year ago so i need little help..I have two classes course and student. The course class is : [CODE=c++]class course { private : … |
The End.