190 Posted Topics

Member Avatar for Se7Olutionyg

You are calling drawIntersect() two times: First inside function drawTriangle(), and second time inside main()

Member Avatar for Aia
0
157
Member Avatar for drameshcbe

I need a house, new car, and a yacht too. Why do you need the code? And have you tried it yourself?

Member Avatar for Denniz
0
95
Member Avatar for badbloodyeyez

There is at least one problem :) Some computers have softwares called antiviruses. They could stop your "unnoticed" program to run. And running a program as soon as portable storage device is plugged in, you will need "autorun.ini" file. It has special code. google it

Member Avatar for badbloodyeyez
0
69
Member Avatar for rrreeefff

On line 7 you have: [CODE=cplusplus] int power (int n); // function prototype [/CODE] And later you call your function: [CODE=cplusplus] float power(float a, int n) [/CODE]

Member Avatar for rrreeefff
0
155
Member Avatar for mehtaneha84

You cannot return a pointer in one case, and "packet" in other. Both should be packets, or pointers. How do you want to use this function?

Member Avatar for Sci@phy
0
181
Member Avatar for andyT

See if you can use vector::get_allocator() I'm not sure if it would work, but try it

Member Avatar for andyT
0
227
Member Avatar for aoi

I presume h is a pointer to the first node? Like: NODE* h; In that case, this code: [CODE=c] if(*h==NULL) //should be: if (h == NULL) [/CODE] Because (*h) is actualy the node itself, and not a pointer.

Member Avatar for ahamed101
0
109
Member Avatar for cplusplusgeek

It's a bad habbit to mix "cin>>" and getline(). The thing is: when you call cin>>, he gets what you need (in this example, char), but leaves everything else (including newline '\n'). And then when getline is called, it just picks up '\n' and stops. Before calling getline, add this: …

Member Avatar for Ancient Dragon
0
133
Member Avatar for nizbit

He could always use: [CODE=cplusplus] Contestant *c = new Contestant(arg1, arg2); [/CODE] BOTTOM LINE IS: Don't allocate dynamically unless you need to. And you need to do it if you don't know (for example) number of contestors. But even then, you could make a vector<Contestant> to store all of them

Member Avatar for grumpier
0
102
Member Avatar for justinlake888

There's no point in asking "which loop do I HAVE to use." Every loop does the same thing. You can try it yourself: write something with for-loop, then try to write same thing with other two loops.

Member Avatar for Sci@phy
0
99
Member Avatar for scholar

And what have you done so far? :) It's rather interesting: n!/(x!*(n-x)!) different combinations, where n is size of string typed, and x is size of output strings

Member Avatar for Sci@phy
0
111
Member Avatar for Jennifer84

Found this using google: [URL="http://snippets.dzone.com/posts/show/2130"]Example[/URL] [CODE] 1 2 private void ImportCountries() 3 { 4 string delimiter = ","; 5 string fileName = @"c:\countrylist3.csv"; 6 7 StreamReader sr = new StreamReader(fileName); 8 9 try 10 { 11 while (sr.Peek() >= 0) 12 { 13 string r = sr.ReadLine(); 14 string[] items …

Member Avatar for Jennifer84
0
261
Member Avatar for rrreeefff

[QUOTE=ssharish2005;700183][code] int return1 (int n)[COLOR="Red"];[/COLOR] [/code] Why is that semicolon there??? Delete that! Syntax error ssharish[/QUOTE] And why is it called return1??? It should be fact!!!

Member Avatar for ahamed101
0
160
Member Avatar for RayvenHawk

You need root pointer that will point at root node inside main fnc. And then call: tree.swapSubtreeNodes(root);

Member Avatar for Sci@phy
0
247
Member Avatar for Royalwolf

Here's what you have to do: [CODE=cplusplus] # include<iostream> using namespace std; int main() { int i; cout << "Please enter the size of square: "; cin >> i; for(int col=0; col<i; col++) { cout <<endl<<endl; for(int row=0; row<i; row++) { if((col==0 || col==i-1) || (row==0) || (row ==i-1)) { …

Member Avatar for Royalwolf
0
3K
Member Avatar for asifjavaid

[CODE=c] #include <stdio.h> #include <termios.h> #include <unistd.h> int getch(){ struct termios oldt, newt; int ch; tcgetattr( STDIN_FILENO, &oldt ); newt = oldt; newt.c_lflag &= ~( ICANON | ECHO ); tcsetattr( STDIN_FILENO, TCSANOW, &newt ); ch = getchar(); tcsetattr( STDIN_FILENO, TCSANOW, &oldt ); return ch; } [/CODE] It works for me. …

Member Avatar for ssharish2005
0
2K
Member Avatar for omdnaik

I don't know. What do you know in c? I started (and still am) as a hobbie programmer, and I learned stuff mostly on internet and e-books. I'm not a good PROGRAMMER, because to be programmer you have to really be one. But here's something for you: do you know …

Member Avatar for ssharish2005
0
163
Member Avatar for rrreeefff

I don't see a problem. You don't need this piece of code: [CODE=cplusplus] { int old_number= 0; int current_number = 1; int next_number; } [/CODE]

Member Avatar for rrreeefff
0
101
Member Avatar for bone7_7

The code is horrible. You still have a lot to learn. But first: [CODE=cplusplus] float calculate_mile_per_hour(float miles, float minutes) //; there's no semicolon here!!! { float mile_per_hour; miles_per_hour = (miles * 60)/minutes); return (mile per hour); } [/CODE]

Member Avatar for bone7_7
0
208
Member Avatar for VernonDozier

This is actually very interesting. Well, first thing, i managed to call const constructor by doing this to main: [CODE=cplusplus] int main () { const MyClass f(4); cout << "In main before Func call: f.x = " << f.x << endl; Func (f); cout << "In main after Func call: …

Member Avatar for VernonDozier
0
424
Member Avatar for khushal.kakakhe
Member Avatar for iichi07

A class should contain only one complex number, not two! You didn't put default constructor in code. ... The code is full of errors

Member Avatar for iichi07
0
263
Member Avatar for NinjaLink
Member Avatar for Lerner
0
110
Member Avatar for vk10
Member Avatar for Sci@phy

I'm a beginner in that area, but would like to learn more. Is there any nice tutorial on the web for Windows OS regarding multithreading?

Member Avatar for Ancient Dragon
0
120
Member Avatar for programmergirl

I can't tell you much without any more info. But just like this: 1. Your .h and .c file need to have the same name 2. In your main function you only include .h file 3. And you have to write: [CODE=c] #include "yourname.h" //and NOT: // #include <yourname.h> [/CODE]

Member Avatar for Sci@phy
0
275
Member Avatar for mauro21pl
Member Avatar for monkey_king

If you want to be able to write [CODE=cplusplus] something = 4 + var; [/CODE] You have to overload once more operator+. First, declare it as friend of class, and then write it like: [CODE=cplusplus] Array<T> operator+ (const float f, Array<T> myVal); [/CODE] That's because if you define operator+ as …

Member Avatar for monkey_king
0
149
Member Avatar for nizbit

You don't need to write your own list! [URL="http://www.cplusplus.com/reference/stl/list/"]Lists in c++[/URL] And "class" is reserved c++ keyword, you can't use it as varable named class!

Member Avatar for nizbit
0
140
Member Avatar for jhonnyboy

Can you be more specific? Why do you need string? Maybe you can use vector<char> instead of array of chars?

Member Avatar for Sci@phy
0
141
Member Avatar for rodeostar04

Well, first, "class" is a c++ keyword, you can't use that name. Second, that last else in your code should be: else if (weight >= 3500 && year >= 1980) or: else Because else means "if nothing before is true", it can't have an expression to evaluate.

Member Avatar for rodeostar04
-1
103
Member Avatar for jrrr

Sounds like you're in a hurry... First of all, DON'T USE <iostream.h> and <string.h>... Instead use <iostream> and <cstring>. Second, main can't be declared like that, it has to be: int main(){ //code here return 0; } Cheers! EDIT: and yes, you are using system(), that means you have to …

Member Avatar for stilllearning
0
88
Member Avatar for sunveer

And what is the problem? To help you a little, your sequence is the same as: (-1)^2 * x^1/1! + (-1)^3 * x^2/2!...

Member Avatar for stilllearning
0
88
Member Avatar for swbuko
Member Avatar for eehyf
Member Avatar for eehyf
0
192
Member Avatar for Majestics

You can use ostringstream from <sstream>, i use that, although it may not be the easyest way. [CODE] #include <sstream> std::string Convert (float number){ std::ostringstream buff; buff<<number; return buff.str(); } [/CODE] ostringstream and istringstream are basically the same as cout and cin, but they don't print stuff on screen. So …

Member Avatar for stilllearning
0
2K
Member Avatar for kux

It's a long shot, but maybe while optimizing compiler got rid of unneeded functions and code in library?

Member Avatar for ArkM
0
108
Member Avatar for grisha83

The best thing is not to use string to hold only one letter (very bad idea). So instead of [CODE]string letter;[/CODE] you better write: [CODE]char letter;[/CODE] HTH

Member Avatar for Sci@phy
0
104
Member Avatar for Sci@phy

Hi all. I've written my own class Complex, that stores complex numbers. I've overloaded a whole bunch of operators so that you can work with them like with normal numbers. Then i wanted to overload 'new', but I tried it before overloading, and it "seems" to be working. I can …

Member Avatar for kux
0
93
Member Avatar for Sci@phy

Hello. Any way of preventing multiple instances of executables? I'm writing a program that uses a file, it would be quite messy if someone would start another instance of same program. If it depends on OS, I would like to see solutions for windows and unix-type (linux) systems. Thanx

Member Avatar for Duoas
0
409

The End.