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.

0 Endorsements
~6K People Reached
Favorite Forums
Favorite Tags
c++ x 28
Member Avatar for Bigbrain99

Hi guys, I'm still new to C++ and get confused by the codes below.. [CODE]class FLATMATE { string name; public: FLATMATE() { name = "";} FLATMATE(string n){name = n;} string getName(){return name;} void setResident(string n){name = n;} };[/CODE] [CODE]class DUTY { FLATMATE resident; //name of the flatmate int RequestOffer; //amount …

Member Avatar for Bigbrain99
0
113
Member Avatar for Bigbrain99

Hi guys, I know what is meant by vector <string> myvector as it will just take every inputs as string when we are trying to store the inputs in myvector. e.g. myvector.push_back(nick) but what about if we declare the type of vector become like vector <FLATMATE> myvector? Why it won't …

Member Avatar for Bigbrain99
0
102
Member Avatar for Bigbrain99

Hi guys, I just started to learn class in C++ and get confused by some of the codes [code]class FLATMATE { string name; public: FLATMATE() { name = "";} FLATMATE(string n){name = n;} string getName(){return name;} void setResident(string n){name = n;} }; //Below are the base class for different duty …

Member Avatar for Bigbrain99
0
100
Member Avatar for Bigbrain99

Is there any recommended books, websites or practices that i can do to improve my c++? I decide to become a great programmer in the future!

Member Avatar for Duki
0
152
Member Avatar for Bigbrain99

I 'm not quite sure if i did the right way but i just couldn't get the right value for my codes....can anyone figure out the problem? [CODE]for(int x = 0; x<myvector.size();x++) { if(number.compare(0,2,myvector[x],0,2)==0) //compare number(user's input) to the line read from getline { checknumber = true; cout<<"passing compare++"<<endl;//if same …

Member Avatar for Bigbrain99
0
83
Member Avatar for Bigbrain99

I used below codes to pass a value from vector to my cpp file. While i'm doing that, i got segmentation error in my main cpp? Is there anyway to pass the vector value to my main cpp? thx for the help [CODE]void Loadfile() { //cout<<"this is used for loading …

Member Avatar for amrith92
0
103
Member Avatar for Bigbrain99

Is there any way to check if i have added more than 1 same header so that i won't get compiling error while running it?How do i know which one will include the header first and other cpp will include it later?

Member Avatar for Bigbrain99
0
87
Member Avatar for Bigbrain99

[CODE]#include <iostream> #include <string> #include <ctype.h> using namespace std; void isphone(int number) { bool isphone = false; int size2= number.size(); for (int i=0; i<size2; i++) { if(isdigit(number[i])&& size2>=4) { isphone=true; } else isphone = false; if(isphone=true) { cout<<"yes this is a phone number"<<endl; } else cout<<"Invalid number!"<<endl; } } //for …

Member Avatar for Bigbrain99
0
152
Member Avatar for Bigbrain99

Hi guys, actually i'm trying to write a program which will write the user input into dat file and start to count the user input from 1. When user inputs second value, it will go to other line and put 2 in front of user value. Any idea how to …

Member Avatar for mrnutty
0
110
Member Avatar for Bigbrain99

How to label the first input of user as 1 ,second input 2, third input 3..etc by using ofstream append? Everytime when I used terminal to run it e.g. ./addcontact.cpp name1 ./addcontact.cpp name2 so that inside dat file it will has number of sequence in front of new name? e.g. …

Member Avatar for Bigbrain99
0
106
Member Avatar for Bigbrain99

[CODE]void addname(string name) { ofstream myfile(CONTACTS,ios::app ); myfile.open(CONTACTS); if (myfile.is_open()); { myfile<<i++<<name<<endl; myfile.close(); } }[/CODE] Initially the codes just kept on overwriting the existing file, but after that i was told to put ios::app. However, it is still now working....now even worse...ofstream is not even writing the file...hellp..

Member Avatar for Bigbrain99
0
113
Member Avatar for Bigbrain99

when i tried to compile it, why i got expected primary-expression before input? [CODE]#include "mylibrary.h" #include "contadd.h" //for function declaration void Contact::setname(string name) { ofstream myfile; myfile.open(CONTACTS); if (myfile.is_open()); { myfile<<name<<endl; myfile.close(); } i++; } int main(int argc, char* argv[]) { vector <string> input; Contact addingname; if (argc == 2) …

Member Avatar for Bigbrain99
0
329
Member Avatar for Bigbrain99

When i tried to compile it, it gave me this error "no match for operator". Any idea how could this happen? This program will take user input and add it into dat file [CODE]#define CONTACTS "contacts.dat" #include <iostream> //enable the used of cin and cout #include <fstream> //enable writing file …

Member Avatar for Bigbrain99
0
222
Member Avatar for Bigbrain99

currently I'm building a program which can take people contact and add it to a dat file. However, when I tried to run the program, i got this error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript [CODE] class Contact{ private: int phones; string email; string name; public: void …

Member Avatar for Bigbrain99
0
4K