49,761 Topics

Member Avatar for
Member Avatar for brahle

Always use scanf() and printf(). They are much, much faster than cin and cout. Also use stl algorithms, like sort, reverse and find, especialy if they are member functions of a container class you use.

Member Avatar for neithan
0
2K
Member Avatar for khuzdaar

We have started Object Oriented Programming in C++. And it has been four weeks. We were taught about Constructors, copy constructors, operators overloading functions, binary/unary and ofcourse, basics about classes. I need to get a project approved by teacher. She still has to teach us Inheritance. So we still know …

Member Avatar for deceptikon
0
577
Member Avatar for ztdep

Dear friends: I check the value range of double and long double with vs2010, but it gives me the same value. could you please tell me how to use the long double format in vs2010. Regards

Member Avatar for Ancient Dragon
0
1K
Member Avatar for muhammad.khan.3576

// i dont know where i am getting wrong..the answer is contniously zero...plz help me #include<iostream> #include<cstdlib> using namespace std; int rand_val() { return rand()%1000000+10000; } int main() { int i,j; int salary_vec[100]={}; for( i=0;i<100;i++) { salary_vec[j]=rand_val(); } double tax_vec[100]={}; for( j=0;j<100;j++) { if(salary_vec[i]>=70000) { tax_vec[j]=salary_vec[i]*(10/100); } else if((salary_vec[i]>=50000)&&(salary_vec[i]<70000)) { …

Member Avatar for muhammad.khan.3576
0
193
Member Avatar for sadi.ak.351
Member Avatar for np complete
0
39
Member Avatar for sandesh.ps.9

Hai friends,I was developing a code for linked list operations. But while doing deletion, if we give a position except 1, the particular node will be deleted. But if i give position as 1, the node will not be deleted. Please help. I'm posting the code below #include <iostream.h> #include …

Member Avatar for np complete
0
2K
Member Avatar for jongiambi

The question asks: Write and compile a C++ program that simulates the arrivals of airplanes at Regina airport. An airplane is represented using a C++ struct. Each plane belongs to an airline, such as United, and records the city from which it is arriving, for example Chicago. The airport is …

Member Avatar for WaltP
0
297
Member Avatar for daino

Would anyone know what this kind of syntax means. Its in reference to a library I want to include in my c++ applicaiton. It takes this form. Where can I read up about this. I've tried a google search but I'm not sure what to search on. #include <name/name.p> //what …

Member Avatar for daino
0
143
Member Avatar for brian.ediger1

I have a program that has the user input a resistance value, then the program checks to see if it is a valid resistance value, and then prints the min and max, based off a valid tolerance value. Here is my code: Resistor.h #ifndef Resistor_H #define Resistor_H #include <cmath> #include …

Member Avatar for brian.ediger1
0
210
Member Avatar for mandysaini

Hi Friends, I have heard that it isn't that simple to write a program in linux using c. Lots of commands n stuff.Please simplify what actually I've got to do to run turbo c++ in my linux laptop as I am a beginner.

Member Avatar for ghaveIT.000.
0
965
Member Avatar for ar123

Hi there! I am new to daniweb.com and C++ CLI. I am trying to make a program that will tell the user the text for the ListItem number they type in. The ListItem information is stored in a text file with my custom file formatting, which is: <~ListItem 1> text.... …

Member Avatar for ar123
0
283
Member Avatar for pooja123

Hi, I am a beginner and new here. I have a question which might be very easy for you all so thought of asking a good solution. I need to read an integer from console into an array in c++ , can any one please help! for example: I want …

Member Avatar for pooja123
0
173
Member Avatar for juliani91

A corporation has six divisions, each responsible for sales to different geographic locations. Design a DivSales class that keeps sales data for a division, with the following members: • An array with four elements for holding four quarters of sales figures for the division • A private static variable for …

Member Avatar for ravenous
0
666
Member Avatar for kruschev

#include <iostream> #include <cstdlib> #include <cstring> using namespace std; /* * */ #define NAME 5 #define EMAIL 2 int main() { char* address[NAME][EMAIL] = {{"Barrack", "president@whitehouse.gov"}, {"Roger", "rpowell@valleycollege.edu"}, {"Mark", "markz@facebook.com"}, {"Bill", "billg@microsoft.com"}, {"Gaga", "admin@lady-gaga.net"}}; for(int i = 0; i < NAME; i++) { for(int j = 0; j < EMAIL; …

Member Avatar for WaltP
0
144
Member Avatar for ren.lowe.9

Sooo yeah. Not one of those derps begging for a solution, but my solution simply isn't working out how I want it to. TLDR; Letters A-T are supposed to obey the number of coulmns entered by the user, then output them. My program obeys the number of coulmns by recognizing …

Member Avatar for Ancient Dragon
0
215
Member Avatar for Dudearoo

**Dudearoo** *Useing Code::Blocks* Are Programs Dependt on There Library'sI've Wonderd This For Some Time, and I would Love to know this because one of the main reasons i Love C++ is That all its Library's are Basic In the Users Computer, now I want To Download the Boost Librarys but …

Member Avatar for Dudearoo
0
121
Member Avatar for daino

I'm not sure how to ask this but here it goes. I am building a C++ application, in this case I'm building it in Code::Blocks with a MingW compiler. I want to incorporate/utilize/whatever, SQLite into my applicaiton by **including** (#include) the sqlite C code header file sqlite3.h in my project …

Member Avatar for daino
0
1K
Member Avatar for mike.severini.3

/* Create a program that uses a count controlled loop to read the patient's "readings" from a file and adds them up individually, calculates the average for each person (ID), and displays the two totals. Input - (numPatients-) 20 idNum numBP bpReading (1, 2, 3, 4) 1234 - 4 - …

Member Avatar for dx9_programmer
0
268
Member Avatar for Secone

I've got the following program, a header file, .cpp file, and p2.cpp, and it does not run correctly. It works when typing in a text document, but after that, it does not read the file how I want it to. I used the cout statements in main of p2.cpp to …

Member Avatar for dx9_programmer
0
271
Member Avatar for Tinnin

Hi all. I have a website that I'd like to post my C++ endeavours to. I want to make it so the source code can be viewed on my website with the correct colour coding, etc. I'm relatively new to CSS and XHTML. I've been using Notepad++. How do I …

Member Avatar for Tinnin
1
128
Member Avatar for MiniApocalypse

Hiya! Im not new to programming but sometimes i can be really noobie so im sure this is probably really silly. I have an undecleared indentifier that only shows up in the main but is fine in the header and cpp files. I thought it might be an include loop …

Member Avatar for MiniApocalypse
0
329
Member Avatar for Carpetfizz

Hello, I'm trying to make a calculator where the user can input the base of the logarithm function, instead of having to convert it from the default log(base)10. Is there any way to do this in C++? Thanks! Carpetfizz

Member Avatar for vijayan121
0
68
Member Avatar for KellieD

Hi! Im doing an introduction to programming course in college and I have only been studying computer programming for the past six weeks. Our lecturer has given us an assignment to do by thursday which is to write a program that converts all of the uppercase letters to lowercase letters …

Member Avatar for Ancient Dragon
0
3K
Member Avatar for daino

I'm finding it difficult to understand how to get a start on SQLite... I know there are allot of tutorials out there but they all seem to go off on some tangent. Even the books is vuage on how to go about incorporating it into a C++ project. This is …

Member Avatar for daino
0
135
Member Avatar for Koji01

String Compare and File Handling mixing together... I am practicing my self to combine functions together like this. so get this, is it possible to search record from the File using File Handling(fscanf) and compare it from the User's input and display it...check out my program. content of **2003.txt** 1234 …

Member Avatar for Koji01
0
629
Member Avatar for RonKevin

Error: Declaration Syntax error on function input Note: using turbo c++ 4.5 compiler #include "iostream.h" #include "conio.h" #include "stdlib.h" #include "cstring.h" #include "fstream.h" #include "time.h" #include "stdio.h" time_t now=time(0);char*dt=ctime(&now); int ch,dn=0; struct BuyerInfo { char id[5]; string fn; string mn; string ln; string ad; } info[100]; struct grocery { char …

Member Avatar for RonKevin
0
153
Member Avatar for DangleSauce19

My code works for numbers that dont have a remainder of 10 or above, but whenever I get one with a remainder 10 or above it prints out the number, not the letter. Please help #include <iostream> #include <fstream> using namespace std; const int maxstack = 51; class stack_type { …

Member Avatar for WaltP
0
2K
Member Avatar for albert.antwi.90
Member Avatar for albert.antwi.90
Member Avatar for RonKevin

here...theres something wrong it doesnt read all of the file and displays some annoying numbers..i think my code now is right but it isnt when i run the program..whats wrong with it? #include<iostream.h> #include<cstring.h> #include<fstream.h> struct grocery { int barcode; string prodname; string category; float price; } ; int main() …

Member Avatar for WaltP
0
155

The End.