49,761 Topics
| |
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. | |
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 … | |
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 | |
// 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)) { … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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.... … | |
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 … | |
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 … | |
#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; … | |
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 … | |
**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 … | |
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 … | |
/* 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 - … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 { … | |
having problems with solving equations in three variables | |
making a mark list for a school to take records and accumulate marks | |
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() … |
The End.