What's new

Closed C++ program

Status
Not open for further replies.
#include <iostream>
#include <cmath>
using namespace std;

int main() {
int x;
float y;

cout << "Enter base and exponent respectively: ";
cin >> x>> y;

cout << "Result = " << pow(x, y);
return 0;
}




pano ba lagyan ito ng function?


int exponent(int x, iny y){
return pow(x, y);
}
 
pano po ba ang body nito mam please po if you are willing to make a help.. help further iyong knowledge na nalalaman nyo po will pass from generation to generation.. make it sense..


Calling ng function sir sa main ba?

int x, y;
cin >> x;
cin >> y;
//gamitin natin yong function mo.

cout << exponent(x, y);

Pwede mo ring iassign sa value kasi mayroon siyang nirereturn.

int v = exponext(x, y);
cout <<v;
 
na iintindihan ko na ngayon mam.. e pano ba iyong input ng name 5 times using function dapat makalagay ka ng any name at lalabas ang 5 times na name na linagay mo?
 
mam bukas na pass ko nito masakit na po uli ko sa kakahanap kahit idea lang nag mamaka awa po ako pls:(

#include <stdio.h>
int main()
{
char name[20];
printf("Enter name: ");
scanf("%s", name);
printf("Your name is %s.", name);
return 0;
}

ito mam pano gawing function ito lalabas e five times
 
#include<iostream>
#include<string>
using namespace std;


string multiplyString (string str);

int main()
{
string str;

cout<<"Please enter a word: ";
cin>>str;

system("CLS");

str = multiplyString (str);

cout<<str<<endl<<endl;

system("pause");
return 0;
}


string multiplyString (string str)
{
string str2;

for (int x = 0; x < str.size(); x++)
{
str2 = str2 + str;
}

return str2;
}


pano ba gawing horizontal ang output po nito,,, i need help pls
 
#include<iostream>
#include<string>
using namespace std;


string multiplyString (string str);

int main()
{
string str;

cout<<"Please enter a word: ";
cin>>str;

system("CLS");

str = multiplyString (str);

cout<<str<<endl<<endl;

system("pause");
return 0;
}


string multiplyString (string str)
{
string str2;

for (int x = 0; x < str.size(); x++)
{
str2 = str2 + str;
}

return str2;
}


pano ba gawing horizontal ang output po nito,,, i need help pls

Naka horizontal naman sa akin yang code mo sir. Baka next line sana yong 2nd name (str2 += str +"\n") o horizontal pero dapat may space (str2 += str +" ")? Ano ba sana ang output?
 
Status
Not open for further replies.
Back
Top