49,761 Topics

Member Avatar for
Member Avatar for xmoon2000@gmail

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 …

Member Avatar for StuXYZ
0
182
Member Avatar for jan1024188

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 …

Member Avatar for Salem
0
165
Member Avatar for serkan sendur

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 …

Member Avatar for Narue
0
159
Member Avatar for greenbluekidz

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 …

Member Avatar for greenbluekidz
0
136
Member Avatar for egboy

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

Member Avatar for Salem
-1
92
Member Avatar for Liszt
Member Avatar for Liszt
0
110
Member Avatar for ribena500

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?

Member Avatar for Salem
0
72
Member Avatar for jerronimo3000

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 …

Member Avatar for VernonDozier
0
122
Member Avatar for Dendei

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; …

Member Avatar for Freaky_Chris
0
103
Member Avatar for Liszt

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 …

Member Avatar for Liszt
0
131
Member Avatar for denni11998833

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 …

Member Avatar for denni11998833
0
2K
Member Avatar for seebharath

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 …

Member Avatar for Ramy Mahrous
0
265
Member Avatar for azwraith69

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] …

Member Avatar for azwraith69
0
161
Member Avatar for veer123

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 …

Member Avatar for veer123
0
147
Member Avatar for maccold321

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] …

Member Avatar for vmanes
0
110
Member Avatar for Ali22615

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) { …

Member Avatar for Murtan
0
90
Member Avatar for lehe

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, …

Member Avatar for Murtan
0
130
Member Avatar for sfrider0

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 …

Member Avatar for VernonDozier
0
143
Member Avatar for code46

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 …

Member Avatar for code46
0
209
Member Avatar for networkburner

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 …

Member Avatar for Ancient Dragon
0
148
Member Avatar for mps727

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 …

Member Avatar for mps727
0
95
Member Avatar for serkan sendur

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 …

Member Avatar for Narue
0
89
Member Avatar for aburich_44

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 …

Member Avatar for StuXYZ
-1
121
Member Avatar for xyzt

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; …

Member Avatar for Salem
0
80
Member Avatar for Alex_

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 …

0
53
Member Avatar for mahdiahmadirad

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> …

Member Avatar for mahdiahmadirad
0
186
Member Avatar for serkan sendur

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?

Member Avatar for serkan sendur
0
13K
Member Avatar for serkan sendur

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?

Member Avatar for serkan sendur
0
286
Member Avatar for naseerkhan861

hi guys can anybody has a c++ code on permutation cipher and hill cipher ,terms used in cryptography.

Member Avatar for MosaicFuneral
0
70
Member Avatar for Mighty

[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; …

Member Avatar for Salem
0
160

The End.