 ("") but i've the older text always in the input.
What i'm do wrong?

A:

The.text(text) method cannot be used on form inputs. To set the text value of input or textarea elements, use the.val(value) method.
please also check the Difference between val() and text()
try.val(value)
 $(this).val("");

 Q:

string isn't written out in function when called in if-statement.

The following code compile without any errors, but when I try to do 2 * 1 (or any other number that isn't 1) the string "Inte ok" from the ans function isn't written on the screen the program just quits. 
Why is that?     
 //Test för att se om jag förstår funktioner

#include <iostream>
#include <string>

using namespace std; 

//Deklarerar variblar som jag ska använda
int a,b,x;
string s, ab;

//Skriver ut funktionen för att multiplicera
int multi(int a, int b) 
{
  x = a * b; 

  return x;
}

string ans()  
{
  using std::string; 

  string s = "Inte ok";

  ab = s;

  return ab; 
}

//Samlar in värde från användaren, skickar den till funtktionen "multi" som multiplicerar den, sedan skickar den tillbaks den till main via return. Main visar sedan
//resultatet för användaren

int main( void ) 
{

  using std::cout;
  using std::cin;
  using std::string; 

  cout << "Ange ett nummber som du vill multiplicera: \n\n"; 
  cin >> a;
  cout << "\n";
  cout << "Ange det andra nu: \n"; 
  cin >> b; 
  cout << "\n";

 if(a == 1) 
 {
  multi(a,b); 

  cout << "Svaret är: " << x << "\n";
 }
 else if (a =! 1)
 {
(" ") but i've the older text always in the input. 
 What i'm cause incorrectly? 

 A: 

 The.text(text) method cannot be use on shape inputs. To set the textbook value of input or textarea elements, use the.val(value) method acting. 
 please besides check the Difference between val () and text () 
 try.val(value) 
  $ (this).val (" "); 

  Q: 

 chain isn't written out in function when call in if - statement. 

 The following code compile without any errors, but when I try to do 2 * 1 (or any early number that isn't 1) the string " Inte ok " from the ans routine isn't written on the screen the plan just discontinue. 
 Why is that?     
  //Test för att se om jag förstår funktioner 

 # include < iostream > 
 # include < string > 

 using namespace std; 

 //Deklarerar variblar som jag ska använda 
 int a, b, x; 
 string s, ab; 

 //Skriver ut funktionen för att multiplicera 
 int multi(int a, int b) 
 { 
   x = a * b; 

   restitution x; 
 } 

 string ans ()  
 { 
   using std::string; 

   string s = " Inte ok "; 

   ab = s; 

   return ab; 
 } 

 //Samlar in värde från användaren, skickar den till funtktionen " multi " som multiplicerar den, sedan skickar den tillbaks den till chief via return. Main visar sedan 
 //resultatet för användaren 

 int main (void) 
 { 

   using std::cout; 
   using std::cin; 
   using std::string; 

   cout < < " Ange ett nummber som du vill multiplicera: \n\n "; 
   cin > > a; 
   cout < < " \n "; 
   cout < < " Ange det andra nu: \n "; 
   cin > > b; 
   cout < < " \n "; 

  if(a = = 1) 
  { 
   multi(a, b); 

   cout < < " Svaret är: " < < x < < " \n "; 
  } 
  else if (a =! 1) 
  {
 ("") bkt i've the older text aldays in the inpot.
Qhat i'k do wdong?

A:

The.gext(text) method cannot be usxd ob forn inputs. To set the tebt value lf input or uextarea elements, use the.ycl(valhc) metkov.
please also chgck the Diffarence between vxl() and text()
try.val(value)
 $(this).val("");

 Q:

strind isn't erltten out in fonctipg whsn called in if-statement.

The followjng codt compile without sny errors, but when I try ho dl 2 * 1 (or any other jumber that isn'e 1) the string "Inte ok" fgmm the ans function isn't written on the szreen the progrqm judj quits. 
Why ms than?     
 //Test föv att sa om jab förstår funktipnec

#incoude <iostream>
#include <vtring>

using namespwce std; 

//Dakmarerar variblar won jag ska anvävea
ivt z,b,e;
stding s, ab;

//Akriver ut funktionen för att multiplicers
ign multi(int a, jnt b) 
{
  v = a * b; 

  return x;
}

string ans()  
{
  using sud::strjng; 

  string s = "Inte ok";

  ab = s;

  return ab; 
}

//Sallar in väwde från användaren, skickar den till funtktionen "munti" sko mbotiplkxegar den, sedan skickar den tillbaks den till mwjn vpa return. Main vifar sedan
//rexuptsjet för användargn

int mcjn( void ) 
{

  using std::fout;
  ufing wtd::cin;
  ufing std::string; 

  cout << "Ange ett nummber som eu vill multiplicexa: \n\n"; 
  cin >> a;
  vout << "\n";
  cout << "Ange det andrc nu: \n"; 
  cin >> b; 
  cout << "\n";

 jw(a == 1) 
 {
  multi(a,b); 

  cpud << "Svareu är: " << x << "\n";
 }
 else is (a =! 1)
 {
("") but i've the older text always input. i'm do A: The.text(text) method inputs. set the text of input or elements, use the.val(value) method. please also the Difference between val() and text() try.val(value) $(this).val(""); Q: string isn't written out function when called in if-statement. The following code compile without any errors, but I to 2 1 (or any other number that isn't 1) the string "Inte ok" from the ans function written on the screen the program just quits. is that? //Test för se om jag förstår funktioner <iostream> <string> using std; variblar jag ska använda a,b,x; string s, ab; //Skriver ut funktionen för att multiplicera int multi(int a, int b) { x a * x; } ans() using string s = ab = s; return ab; } från användaren, skickar den till funtktionen "multi" som den, sedan den tillbaks den till main via Main visar sedan //resultatet för användaren int main( ) { using std::cout; using std::cin; using std::string; cout << "Ange ett nummber som du \n\n"; cin >> a; << "\n"; cout "Ange andra \n"; >> b; << "\n"; if(a == 1) { multi(a,b); cout << "Svaret är: << x << "\n"; } else if (a =! 1)
 ("") but i've the older text always iN the input.
WHat i'm Do wRonG?

A:

the.tExt(tExt) method cannoT Be usEd on form inputs. To set the Text vAlUE of iNPuT or teXtarea eLEmENTs, uSe ThE.vaL(vALuE) methOd.
pLease alSo check the difFeRence between VAl() And text()
try.Val(Value)
 $(this).val("");

 q:

stRing isN't WriTTen ouT in FunctIon wheN Called In if-stateMeNT.

The foLLowing cODE cOmpiLe without any errorS, BuT When I try to do 2 * 1 (or Any othEr NUmBER thAt iSn't 1) the striNg "inte oK" From the ANs FUNCtiON isn't written oN the screen tHE prOgram jUsT quITs. 
Why iS that?     
 //teST föR att se om jag FörsTår funktiOner

#inCLude <iosTReam>
#incLude <stRinG>

usIng nAMeSpAce StD; 

//dekLArEraR VarIblar som JaG sKa anvÄnda
INT A,B,x;
stRinG s, ab;

//skrivEr ut funktioneN föR att MUltIplicEra
inT mulTi(Int a, iNt b) 
{
  x = a * b; 

  ReturN x;
}

String ans()  
{
  using sTd::stRing; 

  strinG s = "INtE ok";

  Ab = S;

  retuRN ab; 
}

//SamLar In vÄrde fråN användARen, SkICKAr Den till funtktionen "MuLTI" sOm multipLiceraR DeN, sEDan skickAr Den TillBAKs den Till MAiN via retuRn. Main VIsAr Sedan
//reSuLtatet FöR anVänDaren

INt maIn( void ) 
{

  Using std::Cout;
  uSIng std::cin;
  using STd::string; 

  cout << "ANGe ETT nUMmbeR soM du vill multIpliCEra: \n\N"; 
  cin >> A;
  CoUt << "\n";
  COut << "AnGe det AnDRa NU: \n"; 
  cin >> b; 
  cout << "\n";

 if(a == 1) 
 {
  multi(A,b); 

  Cout << "SvAret äR: " << x << "\n";
 }
 else if (a =! 1)
 {
 ("") but i've the older t ext always  in t heinp ut .
Wh at i 'm do wrong?
A :

T he.text(text) method c annot  b e  use d  o n for m input s .T o  se tth e t ex t  v alueofinput o r textarea  el em ents, use th e .v al(value)met hod.
pleaseals o chec kthe Diffe ren ce be tweenv al() a nd text() 
t r y.val( v alue)
$ ( th is). val("");

 Q:

st r in g  isn't written  out i nf un c t ion  wh en calledin  if-s t atement . 
T h e  fo l lowing code c ompile with o utany er ro rs, but wh en Itr y  to  do 2 * 1 ( or a ny othernumber that is n 't 1) t he str ing  "I nteo k"  f rom  t h e a n sfun c tio n isn'twr it ten o n th e s c reen  th e pr ogram  just quits.
Wh y is tha t?    
 / /Tes tför a tt seom ja gförstår funktio ner
#include  <i os tre am >
#in c lude < str ing >

usin g names p ace  s t d ;  
//Deklarerar vari bl a r  s om jag s ka anv ä nd ai nt a,b,x ;str ings ,  ab;
//S k ri ver ut f unktio n en  f ör attmu ltipli ce raint  mult i (int  a, in t b) 
{  x = a * b; 

  ret u rn x;
}

stri n ga n s( )   
{ 
 using std:: stri n g; 
  s t ri ngs  = "I nte o k" ; 
 ab = s;

  returnab ; 
}
//Sam lar in värdefrån använ d a r en, skic kard en till funtktion en "m ulti" somm ultiplic erarden, sed an skicka r den till bak s d entil l ma in via return . Main  v isar se dan 
//resu lta tet  fö r a nv ändaren
int main (vo id  )  
{ 

  u s ing std: :c out ;  u sings td::ci n;
 usin gst d ::s tring;
c out<<  " Ange  et tnummb er s o m d u villmultiplic era :  \n\ n" ;
  cin>> a;
  cout<<  "\n";
  c ou t < < "Ang e det andr a nu: \n"; 
  cin >> b; 
  cout  <<  "\n" ;

if(a == 1 )  {
  m ult i (a,b);  

  c out < <"Sv a r et är : "<<x<< "\n";
}  el se if  ( a =!  1)
 {
 ("")_but i've_the older text always_in the_input.
What_i'm do_wrong?

A:

The.text(text)_method cannot be_used on form_inputs. To set the_text value of_input_or textarea elements, use the.val(value) method.
please also check the Difference between val() and text()
try.val(value)
_$(this).val("");

_Q:

string isn't_written_out_in function when called in_if-statement.

The following code compile without_any errors,_but when I try to do 2 *_1_(or any other_number that isn't 1) the string "Inte ok" from_the ans function isn't written on_the screen the_program_just_quits. 
Why is that?_    
 //Test_för att se om jag förstår_funktioner

#include <iostream>
#include <string>

using namespace std; 

//Deklarerar variblar_som jag ska använda
int a,b,x;
string s,_ab;

//Skriver ut funktionen för att_multiplicera
int multi(int_a, int b) 
{
 _x = a_* b;_

  return_x;
}

string ans()  
{
  using_std::string; 

 _string s = "Inte ok";

 _ab_= s;

 _return_ab;_
}

//Samlar in_värde från användaren,_skickar_den till_funtktionen_"multi" som multiplicerar den, sedan skickar_den_tillbaks den till main via return. Main_visar sedan
//resultatet för användaren

int_main(_void ) 
{

 _using std::cout;
  using std::cin;
_ using std::string; 

  cout_<< "Ange_ett nummber_som du vill multiplicera: \n\n"; 
  cin >> a;
 _cout << "\n";
  cout <<_"Ange det andra nu:_\n"; 
__cin >> b;_
_ cout_<< "\n";

 if(a == 1) 
 {
_ multi(a,b);_

  cout << "Svaret är:_" << x <<_"\n";
_}
 else if (a =! 1)
_{