B
bistel
Guest
I am learning C++. It is going really well. It is making other stuff I have done in programming really make sense. I was interested in getting started programming with C++ visually. I want to make a program that runs on Windows. I did not know where to get started. There is not a lot of info on the topic. I found a helpful video on YouTube that showed how to get set up. It leaves me off with code like so:
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
int main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Lotto1::MyForm form;
Application::Run(%form);
return 0;
I do not know how to continue from here. How would I add some code that performs something like writing a string like calculating with overloaded functions! If anybody has any examples I would greatly <g class="gr_ gr_38 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="38" id="38">apreciate</g> seeing them.
I want to make a program that calculates values for a sphere or a cylinder with an overloaded function like so:
#include <iostream>
#include "func.h"
using namespace std;
int main()
{
double Pi = 3.14790;
cout << "Enter a radius: ";
double radius = 0;
cin >> radius;
cout << "The sphere = " << calcRound(Pi, radius) << endl;
cout << "Do you want to calculate the a cylinder? (yes = y/no = n) ";
char answer1 = 'n';
cin >> answer1;
if (answer1 == 'y')
{
cout << "Enter a height: ";
int height = 0;
cin >> height;
calcRound(Pi, radius, height);
cout << "The cylinder = " << calcRound(Pi, radius, height) << endl;
}
return 0;
}
double calcRound(double Pi, double radius)
{
Pi = 3.1409316;
double sphere = 4 * Pi * radius * radius * radius;
return sphere;
}
double calcRound(double Pi, double radius, int height)
{
Pi = 3.14317529;
double cylinder = Pi * radius * radius * height;
return cylinder;
}
in func.h:
#ifndef FUNC_H_
#define FUNC_H_
double calcRound(double Pi, double radius);
double calcRound(double Pi, double radius, int height);
#endif // FUNC_H_
Thanks for any help.
The video I watched:
View: https://www.youtube.com/watch?reload=9&v=0XGQIN9hfGQ
Continue reading...
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
int main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Lotto1::MyForm form;
Application::Run(%form);
return 0;
I do not know how to continue from here. How would I add some code that performs something like writing a string like calculating with overloaded functions! If anybody has any examples I would greatly <g class="gr_ gr_38 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="38" id="38">apreciate</g> seeing them.
I want to make a program that calculates values for a sphere or a cylinder with an overloaded function like so:
#include <iostream>
#include "func.h"
using namespace std;
int main()
{
double Pi = 3.14790;
cout << "Enter a radius: ";
double radius = 0;
cin >> radius;
cout << "The sphere = " << calcRound(Pi, radius) << endl;
cout << "Do you want to calculate the a cylinder? (yes = y/no = n) ";
char answer1 = 'n';
cin >> answer1;
if (answer1 == 'y')
{
cout << "Enter a height: ";
int height = 0;
cin >> height;
calcRound(Pi, radius, height);
cout << "The cylinder = " << calcRound(Pi, radius, height) << endl;
}
return 0;
}
double calcRound(double Pi, double radius)
{
Pi = 3.1409316;
double sphere = 4 * Pi * radius * radius * radius;
return sphere;
}
double calcRound(double Pi, double radius, int height)
{
Pi = 3.14317529;
double cylinder = Pi * radius * radius * height;
return cylinder;
}
in func.h:
#ifndef FUNC_H_
#define FUNC_H_
double calcRound(double Pi, double radius);
double calcRound(double Pi, double radius, int height);
#endif // FUNC_H_
Thanks for any help.
The video I watched:
Continue reading...