bool EndThisShit(false);
do {
string input;
cin >> input;
int il;
input.length() = il;
int Ninput[il];
Ninput[il] = input
int y;
for( y = 0; y < il; y++){
int t =1;
Ninput[fo] + t;
i++;
t++;
}
int a;
for(a = 0; a < il; a++) {
enum letter { a = 97, b, c, d, e, f, g, h, i, j, k, l, m, n, o , p, q, r, s, t, u ,v, w ,x ,y ,z};
int b = 0;
cout Ninput[b]
b++;
}
cout << " is this a good solution? y/n >> ";
char yn;
cin >> yn;
if(yn == y) {
EndThisShit = true;
}
if(yn == n) {
EndThisShit = false;
}
}while(!EndThisShit);
}
i need ur help to write c++ porgram...
this is the topic of it
""""" Write a C++ program that calculates the perimeter and area of simple geometrical shapes based on the user’s selection. Let the program handle the perimeter and area calculations for circles, and Parallelograms. The program should display a menu of the three shapes, and then allow the user to select one of the options. Accordingly, the program would request from the user to enter the required parameters of the corresponding geometrical shape in floating-point form (e.g., radius of a circle). The program should interact with the user in a friendly way using a menu such as the following:
C: Circle.
P: Parallelogram.
The program should detect invalid inputs and display appropriate message to the user, accordingly. The following table describes the required parameters and the formulas for finding the perimeter and area for each shape.
Circle
Parallelogram
Parameters
Radius r
Sides S1 and S2
Angle α
Perimeter
2 π r
2(S1 + S2)
0 < α ≤ 90: (S1*S2)sinα
Area
π r2
90 < α ≤ 180: (S1*S2)sin(180-α)
Notes: S1 S2 H = S2 Sin α γ α
Assume π = 3.143;
Parallelogram Area = S1 * H = S1 * S2 * Sinγ
where, γ = 180 - α """
I solved a c++ solution but i don't understand the idea of the program,
so i need help to understand the steps and the use of this program.
Thankyou,
all.
class C1{
public:
C1(const C2& c){ //line 14 (works fine if i remove this constructor)
//...
}
};
class C2{
public:
C2(const C1& c){
//...
}
};
the compiler show me the following error:
prova.cpp:14: error: expected ‘,’ or ‘...’ before ‘&’ token
prova.cpp:14: error: ISO C++ forbids declaration of ‘C2’ with no type
Here we go again. As you can see, I have gotten much further. There are some elements however that I am unsure how to apply (i.e. bool tooMany). I haven't the slightest how to apply that. That is one snag that I have. Another, and the main one, is this:
The following code does work. It calls a file called "studentData.txt". Said file contains the ID#s and Scores on their own lines :
(id) 101
(score) 100
102
95
103
90
...
...
121
0
Now, if I comment that out and just have it read from the arrays that I have hardcoded it works great. I can't quite figure out how to compute the .txt items into the individual arrays to make it use those as opposed to the hardcoded arrays. One of my main issues with reading from a .txt file, is that the only way I know how is using the getline feature. Is there anything better?
Hi, for a class, I'm trying to implement a separate-chaining hash table stored in a vector that contains pointers to vectors where the keys will be stored. This is basically what I have:
Haiiiiiiiiiiiii every one.
i am totally new for VC++ i need a program on vc++ window application.
i need to create a window, on that window i need 3 brouse button look like normal (file brouser) by using this button i need to get file path only.2 look like same and third button should be save as button.
plese help for this code.
I am reading lines from a CSV and don't know what size it'll be, so I place read lines into a list of a structure "obs". Then I want to iterate through this list, put it into another list and then modify contents of the original list so that I can print that later. I am, however, not sure if I'm actually modifying the original.
using namespace std;
struct obs{
int date;
int p;
int attr_price;
int q;
double bcode;
double uniq_store_id;
};
... stuff that fills in a bunch of this_obs into the list
if(condition to start unloading){
list<obs*> qtr_ser_obs;
for (list<obs>::reverse_iterator it=this_series.rbegin() ; it != this_series.rend(); ++it )
{
qtr_ser_obs.push_front(&*it);
for (list<obs*>::reverse_iterator qtr_obs_it =qtr_ser_obs.rbegin(); qtr_obs_it !=qtr_ser_obs.rend();qtr_obs_it++){
(*qtr_obs_it)->attr_price= computed_attr_price;
}
}
}
In this last line, what am I modifying?
Any help would be greatly appreciated. I guess I'm really not sure what is being placed with the line "
I'm pretty new to the C++ world and would really appreciate some help... ...
I'm trying to build a general tree (a tree with one root and N children), I've written the code and compiled it quote/un-quote successfully... ...I say that because I am faced with a runtime error that basically stops my efforts dead in its tracks...
Attached to this is a screenshot of the runtime error...
class GeneralTree{
public:
struct GenTreeNode{
int int_transactionID, int_totalNumChildren;
GenTreeNode *ptr_nextChild;
};
//initialize root
GenTreeNode *root;
GeneralTree(){
int int_totalNumChildren = 0;
}
~GeneralTree(){
clear();
}
void clear(){
//point to the node to be deleted
GenTreeNode *tmp;
//used to visit each node in the tree.
//We start with the first actual node off of "root"
GenTreeNode *traverse = root->ptr_nextChild;
//while the tree is not empty
while(traverse != NULL){
//store the current node
tmp = traverse;
//visit the next node
traverse = traverse->ptr_nextChild;
//free the memory taken up by the current node
delete tmp;
}
}
void addChildren(int *tranID, int cNo){
int int_totalNumChildren = cNo;
GenTreeNode *genTree = new GenTreeNode[int_totalNumChildren];
void PrintTree(GenTreeNode *tree) {
/* .: Print all the items in the tree to which root points...the item in the root is printed first, followed by its children :: as long as the root is not empty :. */
if (tree != NULL){
cout << tree->int_transactionID << " ::- " << tree->int_totalNumChildren << endl;
// Print children
PrintTree(tree->ptr_nextChild);
}
}
I've made a program in Visual Studio, it's a gui meant to control a camera and the functions of it that my problem rotate about are the functions to open and close the link to the camera. The program seems to run but when I run the program outside visual studio(I double click on it in explorer) and open the camera the release version just closes and the debug version tells me a debug assertion failed,
Expression: _CrtIsValidHeapPointer(pUserData)
I'm not sure how to debug this because it runs fine in visual studio.
I'm kind of stumped and I hoped somebody could nudge me in the right direction based on this information. If I post the relevant code it'll be lengthy and it'll make many references other parts of code, and you might need to know something about pixci cameras.
I need to create two enumerations, one for the months in the year and the other for birthstones.
Make a function named getBirthStone that returns the birthstone based on the month.
Jan-garnet
Feb-amethyst
Mar-aquamarine
Apr-diamond
May-emerald
June-pearl
July-ruby
Aug-peridot
Sep-sapphire
Oct-opal
Nov-topaz
Dec-turquoise
Add code to call the function when the user selects the display information option.
Include a menu item to the main menu to display all birth stones. Add code to call getBirthstone for each month.
I have started the assignment, but I'm not quite sure what I'm doing wrong. Any help is highly appreciated!!
Bstone::Bstone ( string ); // consructor intializes Bstone with string supplied as argument
int main()
{
int name; //the user's name
int Bday; //the user's birthday
//prompting the user for their name
cout << "Please enter your name:\n ";
cin >> name;
//prompting user for their birthday
cout << "Please enter your birthday:\n ";
cin >> Bday;
//prompting the user to select one of the following.
cout << "Please select the following, which you want to display:\n ";
//beginning of the switch statement.
switch (Useroptions)
{
case 1: //displaying the user's birthstone.
cout << "Here is " << name << " birthstone \n";
cout << "His birthday is " << Bday;
break;
case 2: //displaying the user's astrogical sign.
cout << name << " astrogical sign is " << ....;
break;
case 3: //displaying the season of which the user's birthday occurs in.
cout << " The season in which " << name << " birthday occurs " << "....";
break;
default;
}
char Months, BirthStone; // Months and Birthstones of the potential users
// enumeration declaration for months
enum Months { Jan = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
I've been looking into boost and c++ reference, as well as some googling, and I cannot find a way to get a thread's execution time, all options I found are related to system time and I need only the execution time for the thread (inside the thread's context). Anyone knows how to get this?
I'm pulling my hair out on this one. It's been a while since I've specified a path for an ofstream. I just want a simple file called "abc.txt" in the C: folder and I want to write "abc" to it. Anyone see anything wrong? Thanks.
#include <fstream>
using namespace std;
int main ()
{
ofstream outs;
outs.open ("C:\\abc.txt");
outs << "abc";
outs.close ();
return 0;
}
2008 scandalz.net
Research is what I'm doing when I don't know what I'm doing.
-- Wernher von Braun