49,761 Topics
| |
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. … | |
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 ; … | |
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. … | |
I need ideas for a C++ [COLOR="Red"]mini [/COLOR]project. It should be complex enough to involve 4 students. | |
[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(); … | |
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 … | |
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? | |
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 … | |
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 … | |
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] … | |
[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); … | |
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 … | |
| 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 … |
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 … | |
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]; … | |
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 … | |
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]; … | |
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> … | |
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; … | |
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. … | |
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 … | |
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. … | |
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 … | |
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"; … | |
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! | |
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, … | |
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 … | |
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 … | |
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 … | |
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. … |
The End.