49,761 Topics
| |
Hi, I ran the code beloew but with different version of the "if" statement. Do either boolean, int or double comparisons. Astonishingly, they all give the same order of timings! I would have assumed that boolean would be MUCH fatser than doubles. Can anyone explain why this is? Moon std::clock_t … | |
Hello guys, I have 2 questions.... 1. I don't know what format is the best for saving screenshots in. I have tried .BMP, its good quality, but 5MB per screenshot is just not acceptable. I have tried .JPG, but quality is too low. TGA is crap (you need apple quicktime … | |
Wikipedia says something like this [I]Aggregate classes An aggregate class is a class with no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions[1]. Such a class can be initialized with a brace-enclosed comma-separated list of initializer-clauses. The following code has the same … | |
I am supposed to code a program that uses 3 parallel arrays. The program should prompt the user to enter in a Product ID. From there it is supposed to search the ids array and then display the corresponding price and quantity remaining. It does not do this. Instead I … | |
Dear Guys, I used the Visual Studio before to send and receive some I/O signals using a parallel port cable, now i would like to know how to do this using serial port specially USB. In conclusion, how to send and recive signals with USB cable. thanks | |
If I have this string: "Hello" How would I do to encrypt this string ? | |
Hi I got this code: (hours_worked[i]-35)=overtime_hours[i]; (overtime_hours[i])-(hours_worked[i])=normal_hours[i]; I get this error: error C2106: '=' : left operand must be l-value What does this mean? | |
ok, i'm still on Hello World because of this. I can compile and link my app without any warnings or errors, but when I run the .exe it will come up with a black box that prints Hello World and then dissappear. It comes up and terminates in less than … | |
Hello i need some help to understand my work heres the code [CODE] #include <iostream> #include <string> #include <sstream> #include <vector> #include <fstream> using namespace std; struct cell1 { int value1; } cell1Data; struct cell2 { int value2; } cell2Data; int main(void) { ifstream myfile("example.txt"); if(!myfile.good()) return 0; vector<cell1> data1; … | |
I have done a windows form application that I have debugged in "Release Mode". I need to ask 2 questions at the same time because I think they depend on eachother and that is my questionmark: 1. When starting this program, there will be a panel visible where you will … | |
Hey, I was wondering if someone could help me out here! I am trying to sort a list of files and remove the last x ones if it exceeds a constant variable (maxbuffersize). Below you can see what I did: I tried to sort the vector based on the predicate … | |
I have a a function that is written in pure unmanaged c++ . i want to convert this to a dll and use this in a c# application .. Is this possible and if so how? Can anyone please give some sample code to do this or any links. I … | |
good day everyone.. thx for reading.. this is my problem: i want to use the write() function, in ofstream, to write strings into a file.. but write() requires parameters of const char pointer and streamsize... [icode]for(unsigned i=0; i != questions.size(); i++) { qptr = &questions[i]; //vector element(string) tempfile.write(qptr, stringsize); }[/icode] … | |
Hi want to implement an unordered hashmap ie. FIFO implementation . Below is the code.Please help me with this. [code] #include <hash_map> #include <iostream.h> int main() { hash_map<int,int>testMap; testMap[1]=1; testMap[3]=5; testMap[2]=2; typedef hash_map<int,int>::iterator hashIter; for(hashIter it=testMap.begin();it!=testMap.end();it++) { cout<<it->second<<"\n"; } } [/code] It gives output as 1 2 5 But I … | |
Write a program that initializes a vector with the following array values. int arr[] = {1, 6, 2, 9, 12, 15, 33, 28}; Compute the average value, and then output each value along with its deviation (+/‐) from the average. What i have so far is only the average... [code] … | |
I'm trying to write a program to read lists of number from a txt file then bubble sort it in increace order and find the average of every single list. That's what i got so far #include <iostream> #include <fstream> #include <stdio.h> using namespace std; void bubbleSort(int *array,int length) { … | |
Hi, I am new to using C and C++ libraries. So my questions might seem to be naive. 1. When installed, will the source files ( .c or .cpp) of a library be placed into some system directory like /usr/local/src/ for other code that will use them? 2. If not, … | |
Hey. I have to write a Fraction class for homework and overload for the Fraction class the operators +, -, *, /, +=, -=, *=, /=, and << (the insertion operator). Can somebody please tell me what exactly the insertion operator is supposed to do? I've googled it and all … | |
Hello, I wrote a quicksort program that will give me the execution time of the algorithm. I was running it for 1,000, 10,000, 100,000, 1,000,000, and 10,000,000 numbers. Everything was going fine and then when I changed the amount of numbers it is sorting it gave me a segmentation fault … | |
So, I've been coding C++ for a while now, and in that time I've of course surfed the web a fair bit. Is it just me, or does everybody on the internet just hate conio.h's _getch()? I've seen a lot of forums where people are asking the best way to … | |
Whenever I step through my code, visual studio will step into things like string, and the new operator. When it does this it also leaves a tab for the file open at the top. Is there a way to configure it to only step into code that is loaded in … | |
i keep some formatting data in an array of structs. it is a very long array. is it better to keep this information in another class and inherit from this class or is it better to not inherit from this class but create an instance of that class and use … | |
This has only one function to solve projectile motion, but it doesnt seem like it works, why? [code] //Richard Chaaya //1-25-09 //kinimatics #include <iostream> #include <conio.h> #include <iomanip> #include <string> using namespace std; int main() { //declare variables double dblVix = 0.0; double dblViy = 0.0; double dblVfx= 0.0; double … | |
I really can't understand why the belove code gives error. I get this error: [I][B]In function 'int* bubble_sort(int*)': error: no matching function for call to 'swap(int*&, int&, int&)' [/B][/I] May someone please show me the reason? [CODE]int* bubble_sort(int arr[]) { for(int i=0;i<sizeof(arr);i++){ for(int j=0;j<sizeof(arr);j++){ if(arr[i]>arr[j]) swap(arr, i, j ); break; … | |
Hello, i am having a problem getting an understanding of that issue . Can someone pls offer help? I have no idea what it means(just guessing), i do know what polymorphism is though. I also want to understand what does polymorphism has to do with "the mechanism of message reporting … | |
Hi Dears! I Wrote A Bubble Sort for sorting 2D array of characters. and logically it seems correct, but unfortunately not works. please help me. this is my output: unsorted: mah ali sal Sorted: ali ali mah Here is my Code so far: [CODE] #include <iostream.h> #include <stdio.h> #include <string.h> … | |
hi guys i want to achieve something like this : in header file : [CODE]#pragma once class wef { private: int a[]; void setI(); };[/CODE] and the code file will be like this: [CODE]#include "wef.h" void wef::setI() { a = {1,2,3}; }[/CODE] could you please help me with that? | |
i have a struct and i need to use an array of that struct. The member of that array is definite at compile time, so i am going to hard code them. how do i declare it in my class header file and fill the items in the class file? | |
hi guys can anybody has a c++ code on permutation cipher and hill cipher ,terms used in cryptography. | |
[code=cplusplus] #include<iostream> #include<iomanip> using namespace std; int main () { int month, year; float totalCollected, Sales, CountySalesTax, StateSalesTax; float TotalSalesTax; std::cout<< " What is the Month:"; std::cin>>month; std::cout<<"What is the year:"; std::cin>>year; std::cout<<"What is the total amount collected at register:$"; std::cin>>totalCollected; std::cout<< setprecision (2) << fixed; float sales=totalCollected/1.06; CountySalesTax=sales*.02; StateSalesTax=sales*.04; … |
The End.