help me out!

Oct 5, 2012 at 2:19pm
#include <iostream.h>
int main()
{
char a, f;
float d, b, c;
cout<<"pass\n";
cin<<f;
if (f=='s')
{
cout<<"enter the operator\n";
cin<<a;
if (a=='A')
{
cout<<"1st no\n";
cin>>d;
cout<<"number 2\n";
cin>>b;

c=a+b;
cout<<"sum"<<c;
cout<<"\n";
system("pause");
}
if else(a=='M')
{
cout<<"1st no\n";
cin>>d;
cout<<"number 2\n";
cin>>b;
c=a*b;
cout<<"product"<<c;
cout<<"\n";
system("pause");
}
else
return 0;
}


GUYZZ DIS IS THE CODE.. I AM GETTIN LOTS OF ERROR IN IT..
I USED THE COMPILER OF ttps://compilr.com/ AND DEV C++ 4.9.9.2... PLZZ HELP ME OUT ..
I AM NEW 2 DIS STUFF..
ITS A SIMPLE CALCULATOR WHICH HELP YOU 2 MULTIPLY AND ADD ,, AND IT DEPENDS ON users CHOICE..
and yes the first variable 'f' was just and experiment.. it basically acts as an password... [ i know you guyzzz will laugh at it]
Last edited on Oct 5, 2012 at 2:20pm
Oct 5, 2012 at 2:33pm
Please read and try again:

http://www.cplusplus.com/forum/beginner/1/

Quick tip to get an answer:
-Use codetags (look at <> button)
-Do not use all caps
-Do not use all bold

Try edit your post and someone will help
Last edited on Oct 5, 2012 at 2:36pm
Oct 5, 2012 at 2:51pm
closed account (z05DSL3A)
This should compile (I'll leave it to you to find the logic errors)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>

int main()
{
    char a, f;
    float d, b, c;
    std::cout << "pass\n";
    std::cin >> f;
    if (f=='s')
    {
        std::cout << "enter the operator\n";
        std::cin  >> a;
        if (a=='A')
        {
            std::cout << "1st no\n";
            std::cin >> d;
            std::cout << "number 2\n";
            std::cin >> b;

            c=a+b;
            std::cout << "sum " << c;
            std::cout << "\n";
            system("pause");
        }
        else if(a=='M')
        {
            std::cout << "1st no\n";
            std::cin >> d;
            std::cout << "number 2\n";
            std::cin >> b;
            c=a*b;
            std::cout << "product "<< c;
            std::cout << "\n";
            system("pause");
        }
    }
    return 0;
}
Oct 5, 2012 at 3:51pm
thank you so much.

actually i messed the whole program.
i choosed the wrong variables. due to inproper variable selection
i used cin<< instead if cin>>

actually, its been only 3 days since i started learning c++ from the book my senior students gave me.
so i didnt know the function of 'std'
anyway thanxx for your help
and please dont tell me about 'std' i want to learn c++ step by step ..

regards
Last edited on Oct 5, 2012 at 3:52pm
Topic archived. No new replies allowed.