565 Posted Topics

Member Avatar for toluwanimibosun
Re: dice

[Take a look at this.](http://lmgtfy.com/?q=c%2B%2B+game+of+dice+-+do+my+homework%3F) Btw, searching on google makes your life easier (an ours also). http://www.cplusplus.com/forum/beginner/65998/ Try learning from others mistakes, understand the concept, than try to programm your homework.

Member Avatar for Lucaci Andrew
0
115
Member Avatar for poloblue

The problem here is that you don't have any condition to actually break the loop. Try for example, as an else if command to exit the loop. else if (anotherDay=="q"){ break; } This code, if you put it just above the > else > cout<< "not a valid day. "<<endl; …

Member Avatar for Lucaci Andrew
0
301
Member Avatar for JE821

There must be something related to memory allocation or space in your array. The > Unhandled exception at 0x77c415de shows you that you have mistreated some memory allocation. Frankly I didn't look up closly over your code, but in most cases there are problems with either allocating space in the …

Member Avatar for JE821
0
402
Member Avatar for triumphost

if you're trying to return the size you can do it like this: int size(){ return (vector.size()); } or like this: int size1(){ return ((int)vector.size()); } and if you want to use it in a "for", like this: for (int i=0;i<(int)vector.size();i++){ //do stuff } for (int i=0;i<(int)size();i++){ //do stuff } …

Member Avatar for triumphost
0
203
Member Avatar for shibu2all

this might help you: http://www.somacon.com/p125.php The & is binary bitwise AND. Read the whole link and you'll figure it out.

Member Avatar for shibu2all
0
116
Member Avatar for XodoX

I wouldn't call this thread: Some basic C++ questions about processes, because it's related to UNIX and C. In UNIX C is the language in which you use and program helped by the system, and not in C++. Here, read this http://beej.us/guide/bgipc/output/html/multipage/fork.html It's really usefull and explains really good. And …

Member Avatar for Lucaci Andrew
0
259
Member Avatar for triumphost

I would suggest a double condition "?" operation at > Buffer[I] = (NewValue[I] != '\n') ? NewValue[I] : '\0'; Here's an example of what I'm trying to say: int main(){ string a; for (;;){ cout<<"> "; cin>>a; if (a=="q"){ exit(0); } string b=(a=="b" || a=="B") ? (a=="b" ? "b":"B") :"somethign …

Member Avatar for triumphost
0
465
Member Avatar for schlulol
Member Avatar for Niner710

> I figured out my issue. It had to do with the form that I was selecting I would advise you if the problem had been solved, or you yourself resolved the isue to mark the thread as solved, in order for others who seek problems to solve not to …

Member Avatar for Lucaci Andrew
0
677
Member Avatar for Lomholdt

This website is really complete about tkinter. It might be usefull: [An Introduction to Tkinter](http://www.pythonware.com/library/tkinter/introduction/index.htm). I used to use this when I was dealing with Tkinter. > self._text_entry = Entry(self._text_frame, text="") > self._text_entry.bind("<Key-Return>", self._text_save) An example of binding. [Direct link to the bindings from the Tkinter tutorial.](http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm)

Member Avatar for Lucaci Andrew
0
267
Member Avatar for warzaru

I've looked over your code and as deceptikon said, it works fine. Tested on win 7 ultimate on x64 with MinGW and gcc 4.6.1, thus the error lies somewhere else. I would suggest thou changing the operator< function to this: bool operator<(const RAngle& rhs)const { return (l<rhs.l); } This will …

Member Avatar for Lucaci Andrew
0
326
Member Avatar for oscargrower11

Indeed. @ line 20 > delete cfg; will delete the 1st time when it gets there, but there can be multiple times when that line is accessed, so in further accesses it will crash the program, not knowing what to delete.

Member Avatar for Lucaci Andrew
0
567
Member Avatar for poloblue

If you have trouble with your while loop, try with the for one: Here's a quick example. #include <iostream> #include <string> using namespace std; int main(){ for (string a;a!="y";){ //the for exits only when "y" is typed. cout<<"> "; cin>>a; if (a=="1" or a=="1."){ // if you type "1" or …

Member Avatar for Lucaci Andrew
0
121
Member Avatar for Dudearoo

Do you want a string-based menu interface for console, or you just want to make something out of the ASCII and the `switch() {case:''}` methods? I found that the bug in your program lies on the lines 24-25. The switch case, when 'w' is pressed it's ok, the score will …

Member Avatar for Dudearoo
0
353
Member Avatar for Albino

#include <string> #include <iostream> using namespace std; struct pieces { string ap, bp, cp, dp, ep, fp, gp, hp, ip, jp, lr, rr, lk, rk, lb, rb, q, k; } b, w; int main(){ b.ap="Hello"; w.ap=" world.\n"; cout<<b.ap<<w.ap; } /* * Output: * Hello world. */ I can't see where …

Member Avatar for Albino
0
279
Member Avatar for existinglady

You must use the `getline` method. Here's an easy example: #include <iostream> #include <string> using namespace std; int main(){ string answer; cout<<"> "; getline(cin, answer); cin.ignore(); cout<<"I have just inserted: "<<answer<<endl; return (0); } The `getline(cin, answer);` will take whatever you insert, even the spaces, till the `ENTER` signal is …

Member Avatar for Lucaci Andrew
0
415
Member Avatar for atown282

Depeinding on your OS: if you do work in UNIX, it is possible by a C-signal handle function. #include <signal.h> #include <stdlib.h> void handler(int sig){ printf("Received signal %d and now I'm exiting.", sig); // or cout. exit(0); } int main(){ signal(SIGINT, handler); //do stuff; return (0); } But this is …

Member Avatar for Lucaci Andrew
1
578
Member Avatar for Dudearoo

Why don't you use like this: #include <iostream> #include <string> using namespace std; int main(){ int repeat = 2; string answer; while (repeat != 0){ cout << "Insert yes or no: " << endl; cin>>answer; if (answer == "no" or answer == "No" or answer == "NO"){ repeat--; } if …

Member Avatar for rubberman
0
160
Member Avatar for sternone

I would suggest also PHP, 'cose its syntax derivate from C, and C++ syntax also. > Influenced by C, C++, Java, Perl, Tcl > Implementation language C Got them outa Wikipedia.

Member Avatar for sternone
0
248
Member Avatar for zaphoenix

thou, I don't really see where's the problem? > Number of lines,words,letters is : 14 15 128 > > please someone help me to output of the code as > Number of lines,words,letters is : 14 15 128 Isn't this the given output?

Member Avatar for HiHe
0
154
Member Avatar for new_developer

Remove the endl after the cout expresion inside the for. The `for` statement will print out i and the new line every time it pharshes through the conditions. Use like: for (int i=0;i<n;i++) cout<<i<<" "; cout<<"\n"; // or cout<<endl; or as Schol-R-LEA stated, if you don't want the extra space: …

Member Avatar for new_developer
0
1K
Member Avatar for kuki123

You should definately post a little more about your situation? You can simply do like this: //Pseudocode. //1st suggestion: Login(){ return (retrive_previous_id()); } SetLogIn(){ this->id=Login(); } InsertInfo(); Logout(){ //increment id. set_previous_id(id++); } // 2nd suggestion: Login(){ return (retrive_previous_id()); } SetLogIn(){ //here you increment the id. this->id=Login()+1; } InsertInfo(); Logout(){ set_previous_id(id); …

Member Avatar for Schol-R-LEA
0
185
Member Avatar for funkey100

void encode(string str) { char * ccode = new char [str.size()+1], * ncode = new char [str.size()+1]; int str_size = str.size()+1; strcpy (ccode, str.c_str()); for (int i=0; i!=str_size; i++) { if (ccode[i]=='t') { ncode[i]='p'; } cout << ncode; } delete ccode, ncode; }

Member Avatar for Schol-R-LEA
0
313
Member Avatar for abelLazm
Member Avatar for DeanMSands3
0
262
Member Avatar for Onlineshade

In your program the <iostream> is spelled wrong, but as I can now see, it was already covered by some1 else, and the .h is depreciated in the C++ language nowdays.

Member Avatar for mustaffa hasan
0
156
Member Avatar for stephanieirene

> Really? What makes you think so? > > You waited 1-1/2 years to make your first post with this newsworthy information??? best wait ever. By looking over your assignment, and what have you accomplish so far, I'd say that you need to get on working. The best way to …

Member Avatar for Lucaci Andrew
0
344
Member Avatar for Lucaci Andrew

Have some problems with the qt destructor. I'm working on QtCreator: here's the class: the .cpp #include "controller.h" Controller::Controller() { } Controller::Controller(MovieRepo *movrep, MovieValidator *movval){ this->movrep=movrep; this->movval=movval; } void Controller::addMov(int id, string title, string desc, string type)throw(ValidatorException){ Movie* mov=new Movie(id, title, desc, type); movval->validate(*mov); movrep->store(*mov); } const Movie* Controller::getById(int id){ …

Member Avatar for Lucaci Andrew
0
272
Member Avatar for Scuppery

Depending on your tastes, steak can be liked by some or hated by others, but in generally, I don't mind. Do you believe in God?

Member Avatar for azareth
0
1K
Member Avatar for rafaquatbutt

I hope this will help you, and I added some explanations along the source code. /* * count.cpp * count.cpp is licensed under GNU GENERAL PUBLIC LICENSE * Created on: May 15, 2012 * Author: sin */ #include <string> #include <iostream> #include <sstream> using namespace std; int main(){ stringstream lettersfound, …

Member Avatar for PrimePackster
0
325
Member Avatar for Lucaci Andrew

I have this function: void read(){ int id; string desc; string title, type; cout<<"Movie's id: "; cin>>id; cout<<"Movie's title: "; cin>>title; cout<<"Movie's description: "; getline(cin, desc, '\n'); cout<<"Movie's type: "; cin>>type; cout<<"You have typed in: " <<id <<" " <<title <<" " <<desc <<" " <<type <<".\n"; } and my …

Member Avatar for Lucaci Andrew
0
281
Member Avatar for Eagletalon

I'm not a pro in this domain, but I will tell you my opinion. Regardless the fact that the startup is really really slow, it may be due to the fact that your code must be improoved to handle large arguments. As you said, it happens only when dealing with …

Member Avatar for Lucaci Andrew
0
1K
Member Avatar for ashboi

Try to put this includes: > #include <iostream> > #include <string> > #include <vector> > #include "Student.h" after this ones in your .h files: > #ifndef COURSE_H > #define COURSE_H

Member Avatar for Lerner
0
184
Member Avatar for Lucaci Andrew

OK, so here's the deal. I'm trying to create 2 programs, a server and a client, which communicates between them. I'm working on Ubuntu, throughout FIFO. So, 1st of all, I create 2 FIFO's: $ mkfifo pipe $ mkfifo pipo Ok, and after that I create the client and the …

Member Avatar for Ancient Dragon
0
257
Member Avatar for thanadaray

If you have like this: a = 2.2 b = 1.4 c = 2.7 d = 3.5 e = 42.8 one easy way is to simple create the list: l=[a, b, c, d, e] print l '''output: [2.2, 1.4, 2.7, 3.5, 42.8]'''

Member Avatar for HiHe
0
201
Member Avatar for Lucaci Andrew

I was wandering what could be the causes of this error message? Like in general. `\\: *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x00402d53",func="Domain::Movie::show",args=[{name="this",value="0x1"}],file="..\\src\\Domain\\Movie.cpp",fullname="e:\\eclipse for c++\\workspace\\lb6-8oop\\src\\domain\\Movie.cpp",line="36"},thread-id="1",stopped-threads="all"` 10x.

Member Avatar for gusano79
0
712
Member Avatar for adityawkhare

I would suggest the Qt GUI tools, if you're working on Eclipse, with the Qt eclipse integration plugin. Here, this might help you: [Lecture 7: QT.](http://www.cs.ubbcluj.ro/~istvanc/oop/lectures/Lecture7.pdf)

Member Avatar for Ancient Dragon
0
571
Member Avatar for Lucaci Andrew

Hi. So my problem is that I can't save into a vector throughout a function, but I can save directly in the vector. /* * asd.cpp * asd.cpp is licensed under GNU GENERAL PUBLIC LICENSE * Created on: May 3, 2012 * Author: sin */ #include <iostream> #include <string> #include …

Member Avatar for Lucaci Andrew
0
172
Member Avatar for gfp91

Well, when you get some errors like this: 1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2059: syntax error : ']' 1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '{' 1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '}' you have missplaced in your program …

Member Avatar for mitrmkar
0
184
Member Avatar for techieg

Here are some useful links for you: [URL="http://www.cplusplus.com/doc/tutorial/classes/"]http://www.cplusplus.com/doc/tutorial/classes/[/URL] [URL="http://www.cplusplus.com/doc/tutorial/classes2/"]http://www.cplusplus.com/doc/tutorial/classes2/[/URL] I suggest you take the advice of VernonDozier, if you don't know much about classes. Standard documentations are useful in such situations.

Member Avatar for Lucaci Andrew
0
2K
Member Avatar for iraj.jelo

Have you searched on google for that? [URL="http://www.wxpython.org/docs/api/wx.MouseEvent-class.html"]http://www.wxpython.org/docs/api/wx.MouseEvent-class.html[/URL] [URL="http://wiki.wxpython.org/How%20to%20Learn%20wxPython"]http://wiki.wxpython.org/How%20to%20Learn%20wxPython[/URL] Duno, but I guess it will help you - topics related to WxPython...

Member Avatar for iraj.jelo
0
124
Member Avatar for roe1and

Hi roe1and. I've look upon your assignment and I've came up with this. It's not much, but I hope it will help you. Note that you would need the same amount of constants 'a', 'b', 'c' from your source file in order for this to work. [code]''' Created on Feb …

Member Avatar for roe1and
0
308
Member Avatar for dineshswamy

If you're on 3.x version of Python, then you'd have to have the print function as a function, meaning print (" "), but clearly that's not the case having the NameError error: [code]NameError: name 'dinesh' is not defined[/code] and the simple print statement: [code]print "%s dinesh" %l[/code] Well all of …

Member Avatar for dineshswamy
0
135
Member Avatar for vlady

Well, apparently, this approach of classes may cause some inconvenients due to the fact that it's not the brightest approach. Try to define some functions which will print that things for you, from inside the class, use some functions to add elements to the class, then, in the main function, …

Member Avatar for Lucaci Andrew
0
136
Member Avatar for Kitty17

I don't know if I should post this here, but here's a code snippet from a game I made, some time ago, while reading the book of Al Sweigart, Invent your own computer games with Python (and I recommend this book if you want to do such games - and …

Member Avatar for Lucaci Andrew
0
696
Member Avatar for happygeek
Member Avatar for happygeek
4
492
Member Avatar for dineshswamy

[CODE]from __future__ import division print 32/10 """ My output: 3.2 """[/CODE] Basically, the [COLOR="purple"]from __future__ import[/COLOR] division, will convert the [b]/[/b] operator into the [COLOR="Red"]floor division operator[/COLOR], which will do the exact division. Note that if you do such thing, the [b]/[/b] operator which was before, meaning 32/10=[3], the real …

Member Avatar for dineshswamy
0
208
Member Avatar for Lucaci Andrew

Hi. I've seen that it's a custom here to present yourself if you are new to Daniweb. Well, this is my laime attempt on doing such: [b]Name[/b]: Lucaci Andrew [b]Age[/b]: 19 [b]Primary role[/b]: Currently, I'm a student of Babeş-Bolyai University Faculty of Mathematics and Computer Science, from Cluj-Napoca, Romania. [b]Main …

0
100
Member Avatar for pythonn8

You want to print as a matrix, or such? [code] # A simple matrix # This matrix is a list of lists # Column and row numbers start with 1 class Matrix(object): def __init__(self, cols, rows): self.cols = cols self.rows = rows # ;;initialize matrix and fill with&amp;nbsp;zeroes self.matrix = …

Member Avatar for pythonn8
0
363
Member Avatar for Lucaci Andrew

So, what is my deal... I'm working on a script, which, at some point will require the user to insert his or hers username and a password. My question is, how can I make that when the user will write in the password box/line whatever, instead of its characters, to …

Member Avatar for Lucaci Andrew
0
180
Member Avatar for Lucaci Andrew

I keep getting this error and i don't understand why. [code]Traceback (most recent call last): File "E:\University\Workspace eclipse\dictionares\src\dcts\dicts.py", line 105, in <module> fr_runt() File "E:\University\Workspace eclipse\dictionares\src\dcts\dicts.py", line 95, in fr_runt run.run() File "E:\University\Workspace eclipse\dictionares\src\dcts\dicts.py", line 58, in run self.data.write(file, key, value) File "E:\University\Workspace eclipse\dictionares\src\dcts\dicts.py", line 23, in write fh = …

Member Avatar for Lucaci Andrew
0
311

The End.