51,593 Topics

Member Avatar for
Member Avatar for biljith

isnt this the shortest method [code=c]#include<iostream.h> #include<conio.h> void main() { clrscr(); int a,i=0; cout<<"enter a number"; cin>>a; while(a>0) { int b=a%10; a=a/10; i=i+b; } cout<<"sum="<<i; getch(); }[/code]

Member Avatar for ReaseySo
0
271
Member Avatar for acmarshall

You will write a program that uses a multidimensional array having 3 rows and 8 columns and sorts each of the rows using both a bubble sort and a selection sort. You must declare the array inside of main. You will have a for loop containing the calls to bubbleSort …

Member Avatar for vmanes
0
207
Member Avatar for bustamorg

Hey I am inputting this string into a this function " A toyota's a toyota". The code should count the frequency of the word and letter count and display it. The issue I am having is that is does not count them all, it misses the last word counts. Here …

Member Avatar for rubberman
0
243
Member Avatar for fahadmunir32

what difficulties most of the beginners in c++ programming student face i guess logic building ** i have a blog about c++ programming for beginners on which i try to things the as simple as i can so every beginner can understand the logic of program. Because once they are …

Member Avatar for rubberman
0
529
Member Avatar for king13

A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $.50 per hour for each hour [I]or part thereof[/I] in excess of three hours. The maximum charge for any given 24-hour period is $10. Assume that no car parks for …

Member Avatar for radhakrishnan.akshai.3
0
24K
Member Avatar for chubbyy.putto

can anyone tell what did i wrong on this random number? http://pastebin.com/M3J9u5sR

Member Avatar for DavidB
0
157
Member Avatar for DavidB

I am trying to use Visual Studio's debugging features more effectively; I certainly do not know all its ins and outs. At the moment, I would like to quickly see the values of an array. See the attached screenshot of the Watch Window. The variable **k** is a global array …

Member Avatar for DavidB
0
1K
Member Avatar for acmarshall

I am doing a programming assignment. This program asks you to collect statistics on precipitation and temperatures from the four quarters of a year and print the calculated results. It is an exercise in using enumerated types and arrays. The measurements are entered at the end of every quarter. Major …

Member Avatar for acmarshall
0
174
Member Avatar for alhawsa

exerted by the rider’s foot yet not exceed the stress placed on the crank arm’s sprocket attachment, is provided by this formua: r^3 = d*p/s*π r is the radius of the cylindrical rod in inches. d is the length of the crank arm in inches. P is the weight placed …

Member Avatar for Stuugie
-3
179
Member Avatar for Learner010

evenafter learning functions , i see a lot new things everyday in functions. its great because it gives the opportunity to learn new things. today , i see a function which have const keyword with function , like this : void fun_name() const{ } i couldn't understand it . would …

Member Avatar for Learner010
0
186
Member Avatar for jabujoukha
Member Avatar for aaron.richards.9404
Member Avatar for ram_7

Hi Team, i have done how to store values from database to Hashtable collection and then able to retrive the hastable data as per specific key from the hashtable. please help me how to do in c++ for the same. please let know which collection is used in c++ and …

Member Avatar for Ancient Dragon
0
102
Member Avatar for mixelplik

I'm playing with all the cstring and string functions, getting familliar with how they work. Below I have a function call to strcata, and all I'm doing is declaring a string within the function, I'm not even using it with anything other than cout. Everytime I run the code it …

Member Avatar for DeanMSands3
0
195
Member Avatar for Labdabeta

Hello, I wrote a library for arbitrary precision arithmetic recently and spent a long time implementing efficient multiplication algorithms. Now I am looking to see if it is possible for me to optimize anywhere else. One place that I thought should be more optimizeable is my division algorithm. Right now …

Member Avatar for mike_2000_17
0
1K
Member Avatar for richkardmunga.hounarable

i just want to enter the world of programming but i didn't know from what i'm starting i took a short look in C also C++ and Java,i just want to get into this nice world

Member Avatar for rubberman
0
104
Member Avatar for Suzie999

I am wrapping the Windows API CreateProcess. Here is my code. int __stdcall _Execute(LPTSTR program, LPTSTR workingdir, WORD show){ // Check if program has content if (!program || !*program){ MessageBox(NULL, L"You must provide path to executable", L"Error", MB_OK); return 0; } // Create buffers and copy program param to szCmd …

Member Avatar for Suzie999
0
325
Member Avatar for awais ch

How i take a full expration from user as input in c++ programme like (2+7 or 7*8 )

Member Avatar for Banfa
0
51
Member Avatar for glao

I want to pass an array from one cpp file to another. first: void wrapper(float **A,int N){ N=2; printf("Allocating Matrices\n"); *A = (float*)malloc(N*N*sizeof(float)); for(int i = 0; i < N; ++i){ for (int j=0;j<N;j++){ *A[j+i*N] = i; } } for(int i = 0; i < N; ++i) { for (int …

Member Avatar for glao
0
239
Member Avatar for Febel

I need a help in coding this program... write a C++ program to read a set of n numbers where n is defined by the user and print the contents of array in the reverse order using class template, numbers should include int and double data types... please reply soon....

Member Avatar for rubberman
0
187
Member Avatar for ganesh.naphade

Hi, I am new to microsoft visual c++(2008).I am unable to install or configure GraphicMagic as [steps](http://www.graphicsmagick.org/INSTALL-windows.html) given are confusing.Any help is appreciated.

Member Avatar for Ancient Dragon
0
157
Member Avatar for PulsarScript

Hi to all,i have to make project with the classes.Can anyone suggest the topic for the project?Or show the idea.Thank you.

Member Avatar for rubberman
0
112
Member Avatar for StarBreezed

I'm writing a program that works with two sets of numbers put into arrays. The program uses overloaded + and - operators. Array one = 2 7 4 2 9 7 Array two = 2 9 8 9 1 10 12 The output should be: For +, New Array = …

Member Avatar for Ancient Dragon
0
347
Member Avatar for Elixir42

Dear Kind DaniWebbers, I am trying to overload the fstream operators (ofstream/ifstream), so that I can save a class to a 'Binary' file and also display it with cout. But the ways in which each need to be implemented is different. Please can you show me how to define different …

Member Avatar for vijayan121
0
4K
Member Avatar for carmen.golz.9

Is this a real code in Dev c ++ I never seen this before example cout<< Concert4 Program Answers.\n\n"; Thanks Carmen

Member Avatar for deceptikon
0
192
Member Avatar for nicholasamh

Hi, I am using Visual studio 2008, C++ MFC to do my programming for serial communication. I am having problem with my source code wehn i complied it. I have link the serial.cpp and serial.h file to my main program. In my main program, i just type Serial.Open(); to test …

Member Avatar for baghere66
0
541
Member Avatar for malik.epperson

I need help with a homework assignment. I am to create a doubly linked list that reads the numbers from file and then compare the time it takes to sort the numbers using three different sorting algorithms. Here is the code that I have. The algorithms are not working(insertion sort …

Member Avatar for malik.epperson
0
1K
Member Avatar for wildplace

i need to create a project that able to run both under linux and windows(visual studio)... i pretty much finish all coding and able to run both windows and linux in separate files the problem i deal with is the header file which visual studio required #include "StdAfx.h" and not …

Member Avatar for deceptikon
0
2K
Member Avatar for TheFearful

So, I was given this specification for a quicksort algorithm and I have no idea where to start. Create a template version of the QuickSort algorithm that will work with any data type. Demonstrate the template with a drive function. If it was to do a quicksort, I could easily …

Member Avatar for TheFearful
0
214
Member Avatar for Damian_2

Okay so I have a class `Student`, which takes a number and a vector as a parameter for the constructor. Everything works well, until I output the values of the vector for every instance. The problem is that the same vector is being shared with EVERY instance I create, but …

Member Avatar for rubberman
0
436
Member Avatar for champmanking

Hi, all. Before I begin I am new to C++. Ok. I'm trying to create a simple 2D game in C++ using SDL, however I have hit upon a small problem. When I try to close the game window nothing happens. I think it's because when I create a new …

Member Avatar for champmanking
0
735
Member Avatar for hetem

Hi, please help me writing Internet traffic simulation and modelling in c++. i dont now how start . if anyone now tutorial, or link please pos here. Thanks

Member Avatar for phorce
0
66
Member Avatar for Curious Gorge

Just out of curiosity I was wondering how library developers created their own string classes. I am sort of a novice with programming but I tried creating my own string class to prove that I could do it. What I wasn't able to solve was how to create an array …

Member Avatar for Curious Gorge
0
222
Member Avatar for Vasthor

http://s11.postimg.org/kxl3cemw3/error.png this is the least error that I can get from multiple time of debugging. [TheCodeFile](http://www.fast-files.com/getfile.aspx?file=70535) StrBlob.h has needed to use something from StrBlobPtr.h and StrBlobPtr.h needed to use something from StrBlob.h I did tried to #include each file on each other respectively, but ofcourse that would be a data …

Member Avatar for Vasthor
0
389
Member Avatar for mixelplik

I'm tryin to search an array of structures for name. I'm comparing a char[] to a struct member with is a char[] my struct struct NBA_Team { char* name; char conference[8]; char division[10]; unsigned short wins = 0; unsigned short losses = 0; float pct; }; My search code void …

Member Avatar for rubberman
0
180
Member Avatar for Brennan_1

I need help with my coding I need to be able to take in at most 300 integers(0 to 100) and then fin the count of zeros and evens. After this i need to add all of the integers up and get the average. Find the maximum and minimum values …

Member Avatar for iamthwee
0
789
Member Avatar for larry burns

I'm interested in improving my programming skills so I can get a programming job. I majored in a STEM subject as an undergrad (not CS) and used C++ for a research project. I'll have to look thru my harddrive to see if I still have the code for that, as …

Member Avatar for Moschops
0
150
Member Avatar for cadam940

There is a famous recursive relation to find Stirling numbers of the first kind, i.e. C(n,k)=C(n−1,k−1)+(n−1)C(n−1,k) This is a solution to the following problem: Given a set of N distinct numbers, how many different permutations of the set exist such that there are exactly K left-to-right maxima? This was not …

Member Avatar for rubberman
0
375
Member Avatar for narvey ann
Member Avatar for rubberman
-1
238
Member Avatar for Purav_1

* * * * * * * * * * * * Can anyone write a program to print this type of pattern?

Member Avatar for rubberman
0
95
Member Avatar for Labdabeta

Hello, I have a particular set up of cast operators and constructors which is leading to a compile-time ambiguity error. I am wondering if somebody can explain why this is happening and what can be done to fix it. For example, here we have 2 classes: class A { int …

Member Avatar for Labdabeta
0
313
Member Avatar for chubbyy.putto

cout << "Enter size of array: " << endl; cin >> size; cout << "Enter elements: "; for(i=0;i<size;i++) { cin >> array[i]; }

Member Avatar for Learner010
1
163
Member Avatar for sohail.butt.144
Member Avatar for rubberman
0
106
Member Avatar for Ericus7

A PROGRAM IN WHICH WILL DECLARA VARIABLE WHICH HOLD A HOURLY WAGE AND NUMBERS OF HOURS WORKS.PROMPT THE USER TO ENTER VALUE FOR HOURLY RATE AND HOURLY WORKED.COMPUTE AND DISPLACE GROSS,WHICH IS CALCULATED AS HOURS MULTIPLY BY RATE FOR THE FRIST FORTHY HOURS,PLUS HOURS MULTIPLY BY 1.5 MULTIPLY BY THE …

Member Avatar for Ancient Dragon
0
114
Member Avatar for chubbyy.putto

for (int index = 0; index < 200; index++) { if(find_array[index] < minimums[0]) { minimums[0] = find_array[index]; //Lowest number cout <<"The index is " << index << endl; // trying to find an index } } for (int index = 0; index < 200; index++) { if(find_array[index] < minimums[1] && …

Member Avatar for chubbyy.putto
1
107
Member Avatar for blazemadej

Having issues making a menu that will subtotal and then display a grand total. My professor is no help. It would be awesome if anyone can point me in the right direction. Because i have no idea why its not working. The program works fine until I get to the …

Member Avatar for blazemadej
0
843
Member Avatar for baid.arham619
Member Avatar for Emma_3

Everything works fine, but the outputted numbers are supposed to be asterisks instead of digits. Ideas? #include <iostream> using std::cout; using std::cin; int main () { int number = 0; char star = '*', stars = '*'; cout << "Please enter a base number to create the triangle: "; cin …

Member Avatar for samson.dadson.3
0
254
Member Avatar for Damian_2

Okay so inside my ArcherArmor.cpp, I'm trying to figure out why the map initializer list isn't working, but for some reason I keep getting "Error C2593: 'operator =' is ambiguous". Here is my code: I also have a class which ArcherArmor is derived from, that has a struct called `Armor`, …

Member Avatar for Damian_2
0
748
Member Avatar for Prashant_3

i wanted to show the magic of a digit nine to my friensd in c so any one plz help me

Member Avatar for android9000
0
110

The End.