49,761 Topics
| |
I wrote the code below and it runs well. However, how do I make it so that 'Jeanne' enters her own name instead of the numeral 01 to get the message 'Welcome Jeanne'? Thank you. // This program assigns a code to 'Jeanne' (analogous to a pass code) [CODE] Actual … | |
| [CODE] #include<iostream.h> #include<stdlib.h> struct rectInfo { int hight; int width; int area; int parimeter; void print() { cout<<hight<<" "<<width<<" "<<area<<" "<<parimeter<<endl; } }; void calArea(rectInfo *p,int n){ for(int i=0;i<n;i++){ p[i].area=p[i].hight*p[i].width; p[i].parimeter=2*(p[i].hight +p[i].width); } } void genData(rectInfo *p,int n) {for(int i=0;i<n;i++){ int a=rand()%10; int b=rand()%10; p[i].hight=a; p[i].width=b; } } int main() … |
for a assignment i need to create an array dynamically so then late i have to sort the array but the problem is i an new in this cousrse and i dontknow how to creat an array dynamically please help any help will be a good start for me \thx | |
Hi there. I wonder if anyone can help me. I have this code but it only works for a 3 by 3 matrix. I was wondering if anyone could help me change it to a for loop so you can work out different matrixes like a 4 by 30 matrix. … | |
[CODE] #include "stdafx.h" #include<iostream> using namespace std; template<class stype> class Stack { private: struct node { stype data; node * next; }*q; public: Stack() { q=NULL; } void push(stype d) { struct node * temp; temp=q; temp=new node; temp->data=d; if(q==NULL) { temp->next=NULL; q=temp; } else { temp->next=q; q=temp; } } … | |
The assignment my instructor has assigned as for to read an input file and count all 3, 4, 5, and 6 letter words and out put those to an output file. From what data I had been provided by my instructor, I think he wants us to use char data … | |
my os : windows xp sp3 compilers : gcc 4.5(minGW) IDE : code blocks 10.05 As the title, when I didn't enable the command [b]-std=c++0x[/b] CImg can work with gcc4.5 and code block(after Build Options > Linker Settings > Link libraries > Add and enter gdi32) Or use this kind … | |
hi, i'm did a program in C++6.0 that retrives data from Access. the program was ok and runs normally for quite sometime and suddenly the error [B]"Unable to Create File Buffer"[/B] appear. After searching high and low for solution and trying multiple suggestions, i found that that problem is because … | |
how to transform from double to int (rounded) ? by using basic stuff ? | |
How Would i be able to check for valid input on cin or getline heres what i have [CODE] #include <iostream> #include <string.h> using namespace std; int main() { string word; getline(cin, word); cout << word; system("PAUSE"); return EXIT_SUCCESS; } [/CODE] what i mean by valid input is either if … | |
How do I change it so that it will only say how many times the program has ran once I typed another key then [B]y[/B]. Output: ================================= Programmer Name: Peter Langlands Program 3 Description: CS 150 Spring 2011 Lab CRN: Date: ================================= Enter an nonnegative number: 10 a0 = 10 … | |
How would I make this program that it tells me the number of odds or evens. I only have 1 number at the time, so I need it to either say 1 odd or 1 even. [CODE]#include <iostream> #include <fstream> using namespace std; void printInfo(); int nonNegative(int a, int k); … | |
I'm new to C/C++ and I'm having difficulty with calculating leap years in my Zeller's Algorithm program (based off of the Gregorian Calendar). I've lost sleep over this code for the last week and this is my final breaking point. I continually get "This day is Friday." for input 1 … | |
i have a empty c++ win32 console program Peter.cpp and a window form John.h added. a error of " error C2061: syntax error : identifier 'John' " just comes out due to the code " Application::Run(new John); " when complie. could you please help me to fix the program? thank … | |
Hello, I am looking to simulate keyboard inpout for a computer in general, not just for a window. I was allready told how to simulate keyboard strokes in a certan window, although I just want to simulate them as they might be in general. As in program says "X" and … | |
I NEED HELP!! I'm writing a program where the user inputs the pH Level and it goes and tells if it is a certain solution. Some of them work some don't Can somebody tell me where in my code I am going wrong. I am not asking for the solution … | |
can anyone tell me if it is possible to connect to a database (for example an access database) from visual c ++ 6.0? And if one can how does one do it? Is it some wholy complicated thing or is it as easy as doing it in visual basic 6.0 … | |
How can I go about concatenating two arrays of char(ex. char boy[] and char girl[]) so that the contents of girl is attached to the contents of boy? | |
I have searched but i can not seem to find an answer to my problem. I have to write a program that lets the user enter their salary, and calculates their salary with a 5% raise for 3 years. When I run the program and enter the value for cSalary … | |
[CODE] #include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <string> #include <vector> #include <sstream> #include <list> #include <limits.h> using namespace std; class Node { public: string name; vector<string> edges; vector<int> dist; }; class Path { public: vector <int> distance; vector <string> fromwhere; vector <int> complete; vector <string> cities; vector … | |
Hi, I am getting an error message when using base classes. The error message is x: undeclared identifier y: undeclared identifier z: undeclared identifier The particle class derives from the fourvector class which derives from the threevector class, as follows. [CODE]#ifndef THREEVECTOR_H // Prevents the class being re-defined #define THREEVECTOR_H … | |
Alright, I have some questions. 1. This code does make some sense right? 2. I keep getting my failure to open file message, did I make the program do that or are my test files just not working? 3. How do I make the program acknowledge - and + as … | |
In this program everything work except the change back, the quarters, dimes, nickels, and pennies wont work, everytihng else works, for my input i used 65.67, which with hst came out to 75.52, the amount tendered was 100. I just need help with getting the quarters, dimes, nickels, and pennies … | |
Hey, I am having trouble trying to set a default value for a function in one of my classes. Here is where I am trying to set it: [CODE] void Sprite::Spr_Blit(SDL_Surface* source, SDL_Surface* dest, SDL_Rect* clip = NULL) { SDL_Rect offset; offset.x = getX(); offset.y =getY(); SDL_BlitSurface(source,clip,dest,&offset); } [/CODE] Here … | |
I need help to make this program be output *******E * ** *** **O****> *** ** * *******E Thanks for helping | |
Hello, I've been searching the internet and i haven't been able to find anything on my problem. Anyways, I'm trying to read cursor positioning on my screen, and send it to a variable. Just to make things easier, what would I type in the code region for a button; [CODE]private: … | |
x =5 while(x<7) print the value of x x=x+1 while(x>2) print the value of x x=x-2 so i was thinking that the output of the program will be 5677753 but my program is against my opinion so i want to know the right output #include <iostream> using std::endl; using std::cin; … | |
hi,please help me with this program ,iwant it to print values of x not x #include <iostream> using namespace std; int main() { int x = 5; while(x < 7) { std::cout<<" value of x"<<'\n'; x=x+1; } while(x > 7) { std::cout<<" value of x"<<'\n'; x=x-2; } return 0; } | |
If I have this structure: [code] class Parent { public: virtual void MyFunction() {// do something} }; class Child { public: virtual void MyFunction() {// do something else} }; [/code] The Parent::MyFunction() seems to always be called, even with: [code] Child MyChild; MyChild.MyFunction(); [/code] Is this expected? David | |
This is my failed attempt at creating the Sieve of Eratosthenes. Can anyone spot any problems? I just started to learn the STL, but the concept of iterators and the STL in general is really difficult for me. -The input represents the number of cases. The variable m represents the … |
The End.