49,761 Topics
| |
class A { A& a; public: A(): a(* new A()) {} }; There is a huge flaw here and before I compiled this code I was hoping that it will fail to compile, But it didn't. At first I felt like I had a big flaw in C++ as it … | |
I keep getting errors in my code. I can enter the first number 1 fine but then is says that letter c or a is not initialized. What am I doing wrong? This is what i have so far [CODE]// Exercise 8.13: ComparingRates.cpp // Application that calculates the amount of … | |
i have just written a small program on DEV C++. i have been using it for couple of months but i never observed this error. [CODE] #include<stdio.h> int main() { printf("Welcome\n"); system("PAUSE"): return 0; } [/CODE] could not create makefile I/o error 32 any idea? what does that mean | |
Can I change a file stream object's read position in C++? I mean I have a file with a series of integers separated by a newline character. Can I read the first five integers into some variables and then move the read position back to read the fifth integer one … | |
I get this g++ warning when I use the [I]-Wconversion[/I] flag. Anybody know how to write this "correctly" ? [QUOTE]a.cpp:15: warning: conversion to ‘float’ alters ‘double’ constant value[/QUOTE] [CODE]#include <iostream> using namespace std; float VAR1(float VAR2) { int VAR3 = (int)(VAR2 * 1.045 * 1.55); // Result must be an … | |
Hi, my name is Anita. I'm new to this forum and I'm here because I am utterly frustrated with this program that I have been working on for days. This program is supposed to ask the user a series of arithmetic problems and report on how the user performs. The … | |
Hi, I'm trying to initialize string with iterators and something like this works: [code=c++] ifstream fin("tmp.txt"); istream_iterator<char> in_i(fin), eos; //here eos is 1 over the end string s(in_i, eos); [/code] but this doesn't: [code=c++] ifstream fin("tmp.txt"); istream_iterator<char> in_i(fin), eos(fin);/* here eos is at this same position as in_i*/ //moving eos … | |
Anyone who can help me please do I am totaly lost. this is the homework: You will implement a set of functions that will analyze and/or manipulate character data. You are provided with a header file called charRoutines.h that contains the declaratins (prototypes) for the functions that you are to … | |
how to display this output ? ********** ********* ******** ******* ****** ***** **** *** ** * ** *** **** ***** ****** ******* ******** ********* ********** thank you... | |
hey guys, I have written a calculator program in C++. It suppose to get the input from the user which is a string. Some thing like ((5+3)/2)*5. If you input that expression it gives 20, which is the correct answer. The problem i am having is that it cannot compute … | |
Hello, I really need your help. I am writing a program to create a polynomial using linked list. The program is to perform different operations such as addition, subtraction, multiplication. I am however having problems setting the coefficients of this polynomial. I have an idea on how to implement the … | |
Hey guys, Does any of you have a clue how can I install the sqlite3 library on my computer? I'm using netbeans for building my application which now needs to handle a database. I already tried to compile the sqlite3 source code but the make command ends into a huge … | |
Hi; I want to connect MySQL database from turbo c++.I have installed MySQL 5.0.Also MySQL c++ connector.But it's not working.How can i connect.Any body have any procedure for it? Is it possible to connect it directly without any connector?If yes,then how? | |
Hello, i already have C++ class few month , but i still find difficult to write the problem analysis on this project ... This is my question ... "Problem Specification A small scale Airline Company bought a new computer to computerize their airline ticket booking system. The company’s CEO asked … | |
Hi friends, I'm using mandriva 2009 spring. I have a problem in compiling wxwidgets program in anjuta. I've done the things as said in the tutorial file->new->project->c++ tab->wxwidgets->project name,author->forward->folder name etc.->apply. It generated make files and all.It has a program to show a window as well in main.cc. [CODE]#ifdef HAVE_CONFIG_H … | |
Hi, Is it possible to have class template in non template class? I'm trying something like this and I'm getting errors: [code=c++] class Non_Template { //...other stuff public: template<class T> class some_Template; //declaration }; template<class T> //something WRONG with this syntax Non_Template::some_Template { }; [/code] Err msg I'm getting: error … | |
how to display this using for loop ? ***** ***** ***** * * ***** * * ***** ***** thank you for helping. | |
#include <iostream> using namespace std; int main () { int a,b; for (a=1; a<=10; a++) { for (b=1; b<=10-a; b++) cout<<"*"; for(b=10; b<=a; b++) { for (b=1; b<=a; b++) cout<<"*"; } cout<<endl; } system("pause"); } | |
Hi, I am trying to write strings to a file line by line and trying to format the output so that the alignment is proper. output should be it should appear in the output file as david 10 15 16 sam 11 15 16 but appears as david 10 15 … | |
How can I draw text in a glut window with the keyboard; I have tried doing cin with [CODE] void TextBox::Keys(unsigned char key,int x,int y){ switch(key){ case 13://enter key cin >> String; DrawString = true; break; case 27: exit(0); break; } [/CODE] and then in the draw function [CODE] fontx … | |
I have to create a program that accepts 3 user inputs (hours, minutes, seconds) and then asks the user whether they want it to show in standard or military time. The main program should make 2 calls to the function DisplayTime, whether its true if they want standard time or … | |
Hey guys, I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say. It is something like this: Prompt the user to enter (odd) height (of … | |
hi i m beginer in C++ programing.....can someone help me with a problem : i have to program the linux comand hostname in C++.....the c++ program should return the local hostname....thx | |
Hello everyone, I need help with this code, which does not work properly. It prints fine at the first instant and when I convert it into a double it prints some unknown value. I am trying to get the maximum of all the values in the row. First: I cant … | |
can someone help me figure out why my output is incorrect any help would be apprecaited [code]#include<iostream> using namespace std; class fractions { public: fractions fractions :: operator+(fractions f); fractions fractions :: operator-(fractions f); fractions fractions :: operator*(fractions f); fractions fractions :: operator/(fractions f); fractions addFraction(fractions); fractions subFraction(fractions); fractions multiFraction(fractions); … | |
im new with C++ . i was in java but now im learning C++ and i am not very good at it . i am making a program about spam and ham emails . i have all the files in the same directory . i created Ergasia1.cpp , Ergasia1.h , … | |
ok I have to do standard database functions (add, delete, update records. print one record, print all records, etc) with a binary file. The only problem I'm having is, obviously with singular operations (add, update delet and print one) you have to perform a search to find the record you … | |
can someone help me figure out why the output of my program is coming out wrong [code] #include<iostream> using namespace std; class fractions { public: fractions fractions :: operator+(fractions f); fractions fractions :: operator-(fractions f); fractions fractions :: operator*(fractions f); fractions fractions :: operator/(fractions f); fractions addFraction(fractions); fractions subFraction(fractions); fractions … | |
this is my function [CODE]double area (int side_a, int side_b, int side_c) { double semi; double area_ans; semi = semi_peri (side_a, side_b, side_c); [COLOR="Red"]area_ans = (sqrt(semi * (semi - side_a)(semi - side_b) (semi- side_c)));[/COLOR] return area_ans; } double semi_peri (int side_a, int side_b, int side_c) { double semi_ans; semi_ans = … |
The End.