User Profile
Collapse
-
the datatype of my input is char... and the datatype of my output is an int because i want to count the amount of letters until i reach a letter a...Leave a comment:
-
-
like i know id start off with
Code:int main() cout find_a(cin) return 0;
im thinking i should use int istream and then a do while loop to count.... does that sound right?...Leave a comment:
-
ok he said our main function only needs these two lines of code:
Code:cout find_a(cin); return 0;
Leave a comment:
-
My professor called it a hypothetical function. And also said This function will take a arbitrary input stream reference as a parameter, then read characters in from the stream until it finds an 'a'. The function should then return the number of characters read.
I'm pretty sure i know how to have it count the number of characters. Its more or less trying to figure out how to use find_a()....Leave a comment:
-
Need info
I'm trying to write a program with the function of find_a()... i haven't learned this yet so i was wondering if anyone knew anything about it or could point me in the right direction to find out something about it... -
i can rerun it now... but now everytime it does not print out my answers..
[CODE=c]
do
{
cout<<"Metric to English and English to Metric converter.\n"
<<"For Metric to English type m, for Enlish to Metric type E, Type q to quit.\n";
cin>>letter;
get_numbers(fir st_num, second_num);
if(letter == 'm' ||...Leave a comment:
-
rerun program
just wondering how to rerun my program after printing out the answer... -
socondc22 started a topic Converting English to Metric and vice versa via pass-by-reference void function.in CConverting English to Metric and vice versa via pass-by-reference void function.
Im stuck at this point. The way i was trying to do this was running if statement around my void function and then a else if statement around a different void function but it didnt work... right now i deleted part of what i had but left my skeleton of it there...
[CODE=c] #include <iostream>
using namespace std;
void get_numbers(dou ble& input1, double& input2);
void show_results(do uble output1,... -
Code:int main() { char letter; cout<<"Metric to English and English to Metric converter.\n" <<"For Metric to English type m, for Enlish to Metric type E, Type q to quit.\n"; cin>>letter; double first_num, second_num; get_numbers(first_num, second_num); show_results(first_num, second_num);
Leave a comment:
-
Can someone tell me why i can't do this and help me out with what i should do...
Code:if(letter == 'm' || letter == 'M') {void get_numbers(double& input1, double& input2) { using namespace std; cout<< "Enter first number as meters and second as centimeters.\n"; cin>> input1 >> input2; input1 = input1 * 3.2808399; input2 =
Leave a comment:
-
I only have those three choices. so i figured i could do if, then if else, then if else again and it would be fine.... also im getting an error because im using if outside of my int main() for void functions... am i not allowed to do that?...Leave a comment:
-
if else statements
if i want to have a selection that uses letters such as m for metric, e for english, or q for quit to select which part of my if else statement i want to run... how would i set that up... i want to say that it would be....
Code:cin>> letter; if(letter == 'm')
-
my real question is that when i use void swap_numbers is that just going to swap the numbers... or is there something that i should use instead that is used for if im converting numbers and not swappingLeave a comment:
-
This is my exact program that i have to write. Now if i get inputs using void get_numbers (int& input1, int& input2). then when i use void swap_values would that be where my conversion would take place?
1. ask the user if he wants to convert from metric (m), convert from english (e), or quit (q);
2. get either feet & inches or meters & centimeters from the user;
3. perform the...Leave a comment:
-
Ok... can anyone help me with how i should start this... i went through the tutorial and i didn't understand how i could do this program with a void function...Leave a comment:
-
this just doesn't seem like it would be the easiest way to write the program that i have to write..Leave a comment:
-
-
void functions
I'm trying to figure out why my prof would want us to run a conversion of metric to english and english to metric through a void function and using call-by-reference. Also i was wondering if anyone had any points in how to start this, i really don't understand the void functions with call-by-reference.
No activity results to display
Show More
Leave a comment: