49,761 Topics

Member Avatar for
Member Avatar for gregarion

Hey guys , as from what i read up , the function srand() and rand() are able to give u random numbers if they are being run one time only. What i am trying to do is to produce a set of random and unique numbers from 1 - 10. …

Member Avatar for ixmike88
0
114
Member Avatar for bufospro

Hi all, I am new in c++ programming and I am trying to make some examples But unfortunately I have some problems My code is : [CODE] #include <iostream> #include <string> using namespace std; int main() { string firstname, lastname, fullname; cout << "First name: "; cin >> firstname ; …

Member Avatar for stevanity
0
99
Member Avatar for sg79

Hello, can someone help me write this C++ program: An array can be used to store large integers one digit at a time. For example, the integer 1234 could be stored in the array a by setting a[0] to 11, a[1] to 2, a[2] to 3, and a[3] to 4. …

Member Avatar for Intrade
0
274
Member Avatar for rogue005

I need ideas for a C++ [COLOR="Red"]mini [/COLOR]project. It should be complex enough to involve 4 students.

Member Avatar for alibabashaun
-1
679
Member Avatar for sabareesh

[CODE] // for get info from document class strText = pDoc->GetText(); lfFont = pDoc->GetFontInfo(); clrNew = pDoc->GetColorInfo(); // get size GetClientRect(&rcPoint); //// create the font VERIFY(fntNew.CreateFontIndirect(&lfFont)); // create font CFont* fntOld = pDC->SelectObject(&fntNew); // set text color pDC->SetTextColor(clrNew); // for display text pDC->DrawText(strText, strText.GetLength(), &rcPoint,0 ); // delete font fntOld->DeleteObject(); …

Member Avatar for sabareesh
0
84
Member Avatar for sabareesh

DrawText with specified Color and Font For that what property i want to use in DrawText Methord? [CODE]// // pDC Client device GetClientRect(&rcPoint); //// create the font VERIFY(fntNew.CreateFontIndirect(&lfFont)); // create font CFont* fntOld = pDC->SelectObject(&fntNew); // set text color pDC->SetTextColor(clrNew); // for display text pDC->DrawText(strText, strText.GetLength(), &rcPoint,0 ); // delete …

0
54
Member Avatar for mybluehair

I've been looking at some tutorials on an easy way to open a c++ thread, but all have different answers and solutions. does anyone have a nice tutorial?

Member Avatar for DELmE
0
154
Member Avatar for Tahir33

Hi,here is another interesting problem that will make you think. The tower of happiness is located in the garden of effort.Happiness is waiting for you in the top chamber of the tower.The stairs that lead you to the chamber has N steps and you are allowed to climb up one …

Member Avatar for Tahir33
-3
205
Member Avatar for baltair

I am trying to break from an infinite for loop, if the user has entered a blank line, but I want to continue if the user has entered a word. here is code to show. [CODE]#include <iostream> using namespace std; int main( void ) { char szMessage[32]; for(;;) { cout …

Member Avatar for baltair
0
112
Member Avatar for hq1

Hi, so I wrote this program to find the GCD of two numbers, the program runs just fine its that I also need it to display how many times it loops, I cant get it to do that. Can some one please tell me what I'm doing wrong, Thanks! [CODE] …

Member Avatar for hq1
0
87
Member Avatar for Ilyana

[code] #include <cstdlib> #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { const int SIZE=81; char input[SIZE]; fstream nameFile; nameFile.open("Bands.txt", ios::in); if (!nameFile) { cout << "Error: Cannot open file." << endl; return 0; } nameFile.getline(input, SIZE); while (!nameFile.eof()) { cout << input << endl; nameFile.getline(input, SIZE); …

Member Avatar for Ilyana
0
98
Member Avatar for JCal1108

My task was to write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the number of elements to allocate. The function should return a pointer to the array. Here is the code I wrote, my pointer returns the starting address of …

Member Avatar for Unimportant
0
117
Member Avatar for Smithy566

Hi all, to simplify my problem, I'll use a quick example. Imagine I have a class of 'Cat' which has accessors for things like 'name', 'colour' and 'height'. I then put these cats in a list [CODE]List<Cat^>^ catList;[/CODE] I want to be able to search this list based on the …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for gerard4143

Hi, I have a question about constructors and the difference between passing by value and by reference. If you look at the two examples I attached. Example one has a constructor that passes by value and example two pass by reference. Now I want to know why example one will …

Member Avatar for gerard4143
0
117
Member Avatar for Violet_82

Hi all, I am trying to make sure that users can only input integers in my program and no other types. Here is the program: [CODE]#include<iostream> using namespace std; int main() { int numbers[9]; int k; cout<<"Enter 9 numbers: "; for( k = 0; k<9; k++) { cin >> numbers[k]; …

Member Avatar for Violet_82
0
143
Member Avatar for raheel_88

I'm having trouble with a for loop! I'm trying to solve a differential equation using Euler's method like so; [TEX]\displaystyle\frac{dy}{dx} = 7{y^2}cos(y^2)-3e^{xy}, \ \ \ 0 \leq x \leq 1 \ \ \ y(0) = 0[/TEX] This is solved using the algorithm [TEX]y_{n+1} = y_n + hf(x_n , y_n)[/TEX] Where …

Member Avatar for Unimportant
0
832
Member Avatar for vbx_wx

Why my program doesnt print ? [code] #include <iostream> using namespace std; class String { string s; public: String(string ss): s(ss) {} string substr(int pos = 0, int n = string::npos) { string str; int j = 0; for(int i = pos; i <= n; i++) { str[j] = s[i]; …

Member Avatar for Ancient Dragon
0
94
Member Avatar for BlueZephyr

I am have some really weird iostream errors. This is my first time using functions. Maybe I did something completely wrong. I just need someone to point out my error and maybe help with building a function to find the minimum value out of 4 input numbers. [code=c] #include <iostream> …

Member Avatar for BlueZephyr
0
116
Member Avatar for Jennifer84

Is it possible to use a buttoncontrol to pause a for loop. Ex: When it has counted to 50000, I press Pause and when I press Pause again, the loop continues. Is it possible to achieve something like this ? [code] for ( int i = 0; i < 100000; …

Member Avatar for WaltP
0
4K
Member Avatar for kra9853

I need to modify my program to use while and for loops and be able to do the following tasks: a. A score of I on the project forces a mid-term grade of I. Notify the user to contact both the student and their advisor of the I grade. b. …

Member Avatar for Lerner
0
121
Member Avatar for Сторм

Hi everybody. I'm new in programming and just started i have found one compiler "Code Blocks" its rate was high though. So i chose it. Wanted to ask any compiler that you guys use? Okay so here is the problem. I wanted to code a few rows. To find a …

0
39
Member Avatar for Vllinator

Hi i need help on searching an array for a match. They can be in any order, and does not need to be in a sequence. The theArray has 6 numbers in each row, with 10 lines (i have made 2 to keep things simple). The randArray has 8 numbers. …

Member Avatar for Lerner
0
99
Member Avatar for bob200707

Could someone help me put the following C++ in correct order. The statements in the following program are not in the correct order. Rearrange the statements so that hte program outputs the total time an employee spent on the job each day. Th program asks the user to enter the …

Member Avatar for Lerner
0
686
Member Avatar for stevanity

Can anyone explain this code used to implement prims algorithm to find min spanning tree [CODE] #include <iostream> using namespace std; int g[20][20],visited[20],d[20],p[20]; int v,e; void creategraph() { int i,j,a,b,w; cout<<"\nVertices: "; cin>>v; cout<<"\nEdges "; cin>>e; for(i=1;i<=v;i++) for(j=1;j<=v;j++) g[i][j]=0; for(i=1;i<=v;i++) { p[i]=visited[i]=0; d[i]=32767; } for(j=1;j<=e;j++) { cout<<"\nEnter (a,b) and cost\n"; …

0
54
Member Avatar for khiah12

how to create a game program using conditional statement, array, loopings and function? plaese..i need help from you guys.. Its for my school pgoject..thanks!

Member Avatar for Lerner
-1
97
Member Avatar for peterman.k

I am going out of town and don't have access to my professor and / or tutors for the weekend, and we have an assignment involving a BST. I have done all of my insert, remove, and search functions, and went to the tutor about the remaining ones I have, …

Member Avatar for peterman.k
0
227
Member Avatar for gregarion

Hey guys, i am having a problem passing my array into a function . What i am trying to do is to pass my array called Alphabets[] from my main into a function called Key. THe issue i am having is that i keep getting an error telling me that …

Member Avatar for LevyDee
0
113
Member Avatar for marvik

Write a program that will determine the additional state tax owed by an employee. If the state charges a 4% tax on net income determine net income by subtracting a $ 500 allowance for each dependent from gross income. Your program will read gross income number of dependent and tax …

Member Avatar for Ancient Dragon
0
82
Member Avatar for phfilly

hi guys I got this weird error which I cannot debug in my code. The program is to convert Roman numerals to Arabic numerals using the Interpreter design pattern. Here is a part of the program where the errors occurs RNInterpreter.C:8: error: new types may not be defined in a …

Member Avatar for phfilly
0
201
Member Avatar for azim_axl

Hi all, I'm new to C++ & taking my first class in programming. The program ask the user to enter the loan amount, number of years, and interest rate, and then displays the amortization schedule for the loan.The monthly payment for a given loan pays the principal and the interest. …

Member Avatar for Ancient Dragon
0
972

The End.